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
670
InitializeDataSource event causes double the work...
posted

I realize this is not a normal case but I am running a web grid on a MS FormView where the data in the webgrid (LoadOnDemand=XML) is dependent on a bound control for the current page in the form. This means that as the user moves from record to record, the sequence of events are:

UltraWebGrid_InitializeDataSource
UltraWebGrid_InitializeLayout
FormView1_Load
UltraWebToolbar_ButtonClicked (next button to change the page of the formview)
FormView1_PageIndexChanged
UltraWebGrid_InitializeDataSource
Label_DataBinding (pass the value of this control to the data source )
UltraWebGrid_InitializeLayout
FormView1_DataBound

In simple terms, when the user presses the next button to go to the next page, the page posts back, initializes the grid with the old value, pages forward, then re-initializes the grid with the new page value. I cannot detect that the postback is due to a page change because the buttonclicked event happens long after the grid events have fired.

Of course if I was not depedent on a bound control for the value then I would not have to call the databind method and trigger a repeat of the initializedatasource and initializelayout events.

 Any thoughts on how to simplify the process and eliminate the duplication of effort?

 I will keep trying things and post a new approach if I figure it out so maybe someone else could benefit...