Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
WebGrid: Any way to call get datasource to rebind?
posted

Hi

I'm currently using a WebGrid in LoadOnDemand mode, and as such need to handle to InitializeDataSource event for every time the page requests further data.

The problem i'm having is that I have a few search fields on the screen, and if the user chooses to modify these search parameters I get a postback. When that happens, the very first thing that happens (prior to Page_Load) is that InitializeDataSource fires. Having read other posts I inderstand why this is necessary, however what I want to do is modify the DataSource and then have the InitializeDataSource fire again to take into account the new data. I've tried several combinations of modifying the datasource outside of the InitializeDataSource event, and whilst it does actually work the displayed grid only shows the pre-modification data (ie. the data that existed when the InitializeDataSource event last fired). If i scroll the grid, it posts back again and gets the new data, which is great but I dont want the users to have to do the scroll to get the new data.

 Is there any way to get the grid to reconsider the data once the InitializeDataSource event has fired?

 

Chris