0
votes

Telerik grid automatically loads when page is loaded while I want to load it only when search button is clicked

My data binding is like this

.DataBinding(dataBinding =>
{
     dataBinding.Ajax().Select("GetDistrictStudents", "RosterUI", new { filterText = (string)ViewData["Search"], districtId = (int)ViewData["districtId"] });
})

I searched for this but couldn't find much help, this helped a little

http://www.telerik.com/community/forums/aspnet-mvc/grid/ajax-binding---do-not-auto-load.aspx

i.e. disabling grid DataBinding

.DataBinding(dataBinding =>
{
    dataBinding.Ajax().Select("GetDistrictStudents", "RosterUI", 
    new { filterText = (string)ViewData["Search"], districtId = (int)ViewData["districtId"] })
   .Enabled(false);
})

it worked but ofcouse it stopped working completely, so is there any way to enable DataBinding on client?

Or

Any other way to prevent this behavior?

1

1 Answers

0
votes

This is answered in another post: Telerik MVC Grid Ajax with manually binding The solution is quite elegant with just a few lines of javascript.