title: Update Kendo Grid based On Search Form Post
body: <p>I've been doing alot of searching but haven't found a clear answer for this. I have a set up textboxes that and a submit button and a Kendo UI grid. I want to post the data to the grid's datasource so that it will return the results based on the criteria. I am not using the MVC wrappers.</p>
  
  <p>EDIT:
  I've gotten closer but I can't seem to get the datasource to send the post data when I click submit. I've debugged and in my $("#fmSearch").submit it is hitting the jquery plugin and I've confirmed that it is converting the form data to JSON properly, but it seems as though it it not sending the updated information to the server so that the Action can read it.</p>
  
  <p>Javascript</p>
  
  <pre><code>var dsGalleryItem = new kendo.data.DataSource({
          transport: {
              read: {
                  url: '@Url.Content("~/Intranet/GalleryItem/SearchGalleryItems")',
                  type: "POST",
                  data: $("#fmSearch").serializeFormToJSON(),
                  cache: false
              }
          },
          schema: {
              model: {
                  id: "galleryItemID",
                  fields: {
                      galleryItemID: {
                          nullable: true
                      },
                      imageName: {},
                      collectionName: {},
                      categoryName: {},
                      lastUpdatedOn: { type: "date" }
                  }
              }
          }
      });
  
  
  
  
      var gvResults = $("#gvResults").kendoGrid({
          autoBind:false,
              columns: [{
                  field: "imageName",
                  title: "Item Name",
                  template: "&lt;a href='@Url.Content("~/Intranet/GalleryItem/Details/")#=galleryItemID#'&gt; #=imageName#&lt;/a&gt;"
              }, {
                  field: "collectionName",
                  title: "Collection"
              }, {
                  field: "categoryName",
                  title: "Category"
              }, {
                  field: "lastUpdatedOn",
                  title: "Last Updated",
                  format: "{0:M/d/yyyy}"
              }
              ],
              selectable: "row",
              change: onRowSelect,
              dataSource: dsGalleryItem
          });
  
  
  
  
  
  
      $("#fmSearch").submit(
          function (event) {
              event.preventDefault();
              dsGalleryItem.read({ data: $("#fmSearch").serializeFormToJSON() });
      });
  </code></pre>
  
  <p>MVC Action</p>
  
  <pre><code>[HttpPost]
      public JsonResult SearchGalleryItems(string keyword, int? category, int? collection, DateTime? startDate, DateTime? endDate)
      {
  
          var galleryItemList = (from g in db.GalleryItems
                                 //where g.imageName.Contains(keyword)
                                 select new GalleryItemViewModel
                                 {
                                     galleryItemID = g.galleryItemID,
                                     imageName = g.imageName,
                                     collectionName = g.collection.collectionName,
                                     categoryName = g.category.categoryName,
                                     lastUpdatedOn = g.lastUpdatedOn
                                 });
  
          var galleryItemCount = Json(galleryItemList.ToList());
  
          return Json(galleryItemList.ToList()); ;
      }
  </code></pre>
  
  <p>The action is not setup to retrieve different data right now I just need to know how to connect the form to the grid.</p>