How do you rebind the data when a search button is clicked?
I setup the grid as follows:
@( Html.Infragistics().Grid<MVCMobile1.EF_Result>() .ID("Grid1") .AutoGenerateColumns(true) .Columns(column => { column.For(x => x.EntryDate).DataType("date").HeaderText("Entry Date"); }) .DataSourceUrl(Url.Action("SPList")) .Width("90%") .Height("750px") .DataBind() .Render())
I found a solution by not using the Helper function to create the grid but to recreate the grid in jquery every time the search button is clicked. I'm not sure if that is the correct way of doing it. Is there a way to send data to the grid that was created using the helper function?
In the jquery code I am calling:
$(
'#Grid1').igGrid({ dataSource: '/Home/SPList/', ...
Hello,
It really is going to depend on how you want your search to work as to what would be the best approach to take. My recommendation is to send the info from the search back to your controller and let that modify the data that is returned by ActionResult for the DataSourceUrl.
I've attached a sample that demonstrates this approach. In my sample I set up the page and have a button that will commit a post operation. In the HttpPost ActionResult I extract the text from my search field and store that information in Session. Then, in my GridDataSourceAction I check to see if this is set and either return all the data or a subset.
Please let me know if you have any questions or concerns about this approach.