Grid without Ajax

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    29 posts
    Member since:
    Mar 2012

    Posted 04 Sep 2013 Link to this post

    I'm trying to learn both Kendo and MVC at the same time, so bear with me.  In the code below, I know I could populate my grid via Ajax and frankly I'd be more comfortable with that, but I'm trying to acquaint myself with the basics, so I'd like to avoid it for now.

    I would like the contents of my Grid to be restricted by both a DropDownList and a Search box.  The issue is that when you turn on Pageable for a Kendo Grid, it wants to GET the next page.  But since my DropDownList and my Search box will not be part of the GET params, they won't be available to the Action.  So the question:

    Is it hopelessly naive to use Grid without Ajax or is there a straightforward way to either include my additional parameters or make the pagination use the form POST?

    @using (Html.BeginForm(null, null, FormMethod.Post, new { id="searchForm" })) {
          function submit() { $("#searchForm").submit() }
       @(Html.Kendo().DropDownListFor(m => m.ListID).DataValueField("ID").DataTextField("Name")
             .BindTo(Model.Lists).Events(e => e.Change("submit")))
       @Html.Kendo().AutoCompleteFor(m => m.SearchText).Placeholder("Search")
       <input type="submit" value="Search" />
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 06 Sep 2013 Link to this post

    Hello Kevin,

    Of course your scenario is completely valid, you can send those parameters automatically to the server each time when a pagination request is performed.

    This is configured through the data function of the read configuration of the dataSource. Check the example here:

    I hope this is what you are looking for.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top