title: Kendo Grid - Bind Data After Search
body: <p>ASP.NET MVC 4 | .NET 4.5 | Razor| C#</p>
  
  <p>I have a textbox and a button at the top of the page. Below that is a Kendo Grid which is bound to a List in my view model. When the user clicks the search button a jQuery ajax request is made and the data is returned as JSON. The only question I have is how do I bind that data to my Kendo Grid? Any help is appreciated.</p>
  
  <pre><code>@(Html.Kendo().Grid(Model.PurchaseOrder.LineItems)
      .Name("poSearchGrid")
      .Columns(c =&gt;
      {
          c.Bound(x =&gt; x.LineNumber).Title("Line Number");
          c.Bound(x =&gt; x.Qty).Title("PO Qty");
          c.Bound(x =&gt; x.OpenQty).Title("Open Qty");
          c.Bound(x =&gt; x.QtyReceived).Title("Qty Received");
      })
      .Events(e =&gt; e.DataBound("onDataBound"))
      .DataSource(s =&gt; s.Ajax().Model(model =&gt; model.Id(i =&gt; i.ID)))
      )
  </code></pre>
  
  <p>Button Click Ajax Call</p>
  
  <pre><code>$("#btnSearch").on('click', function() {
  console.log("click");
  var searchText = $("#PONumber").val();
  
  if (searchText == "") {
      alert("You must enter a search value");
      return;
  }
  
      $.ajax({
          url: '@Url.Action("Search")',
          data: { poNumber: searchText},
          type: 'POST',
          dataType: "json",
          success: function(result) {
  
          }
      });
  });
  </code></pre>