I'm copying this and the reply from the WebGrid forum. I accidentally posted it there before I realized the old UltraWebGrid had been renamed to "WebGrid".
What is the WebDataGrid equivalent of
UltraWebGrid1.DisplayLayout.SelectedRows.Clear();
?
Basically I have a grid that shows search results and am finding that things like the current page and selected row persist when I reset the data source after a new search, which I don't really want.
Here's where the code would go (this is in page load):
if (newSearch) { gridSearch.Behaviors.Paging.PageIndex = 0;
//HELP! Need to deselect any selected rows. }
Alex K. answered in the other forum with:
Hi John, WebDataGrid has its own forum. Please post firther questions there. Thanks! Have you tried clearing the selectedrows collection off the Selection behavior? gridSearch.Behaviors.Selection.SelectedRows.Clear();
That looked promising but did not work for me. Even if I put this line at the top of page_load with no conditions, the previously selected row does not clear when I rebind the data source/reload the page. Maybe it's somehow staying persisted on the client?
Any ideas?
That did it. Thanks!