This is a migrated thread and some comments may be shown as answers.

Bind Datatable to Grid on button click

4 Answers 553 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 25 Dec 2013, 10:24 AM
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 

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 25 Dec 2013, 01:15 PM
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!
0
Ajay
Top achievements
Rank 1
answered on 25 Dec 2013, 01:30 PM
in case of chrome it is showing json response.
0
Phillip
Top achievements
Rank 1
answered on 09 Nov 2020, 02:08 AM

Hi Dimo,

This link you provided above:

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

is coming back not found - I think this documents exactly what I am after, could you please provide a working link?

Thanks,

Phil.

0
Georgi Denchev
Telerik team
answered on 10 Nov 2020, 01:16 PM

Hi Phil,

In order to pass additional parameters when making a CRUD request, you can use the data method.

The JQuery syntax and the MVC syntax.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Ajay
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Ajay
Top achievements
Rank 1
Phillip
Top achievements
Rank 1
Georgi Denchev
Telerik team
Share this question
or