Bind Datatable to Grid on button click

3 posts, 0 answers
  1. Ajay
    Ajay avatar
    13 posts
    Member since:
    Nov 2010

    Posted 25 Dec 2013 Link to this post

    Hi
    I am trying to bind a data table to Grid on button click.
    I am able bind data, however
    1. I want to show a blank grid when the page is loaded
    2. Show data only on button click
    When I bind the grid, the json response is coming as a JavaScript file to download
    I have attacked the code of controller and view that I am using 
    Also the screenshot 
  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 25 Dec 2013 Link to this post

    Hello Ajay,

    Generally, there is no problem to show an empty Grid. You should either bind it to an empty collection initially, or use Ajax binding and set AutoBind(false).

    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-binding

    http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc.UI.Fluent/GridBuilder#methods-AutoBind(System.Boolean)

    It looks like you want to pass aditional (filtering) parameters to the Grid Read action method. In this case you can configure a Javascript function to be executed when the Grid datasource's client read() method is called.

    http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-binding#pass-additional-data-to-the-action-method

    http://docs.kendoui.com/api/web/grid#fields-dataSource

    http://docs.kendoui.com/api/framework/datasource#methods-read


    The fact that Internet Explorer offers to open/save the JSON response, suggests that the JSON response is sent with a wrong content-type, and/or that the browser doesn't support the response content-type. This is not related to Kendo UI.

    https://www.google.com/search?q=do+you+want+to+open+save+json
    https://www.google.com/search?q=internet+explorer+json+download

    Regards,
    Dimo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Ajay
    Ajay avatar
    13 posts
    Member since:
    Nov 2010

    Posted 25 Dec 2013 Link to this post

    in case of chrome it is showing json response.
Back to Top