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
115
Order of Paging Events
posted

Hi, we're using Infragistics 2007 Volume 1(.Net 1.1) and are trying to use paging on a screen with lots of data.  On this screen you pick which view you want to display and any filter criteria that you may have and then click submit.  Here's the events when you click submit:
OnInit()
Grid_InitializeDataSource()
Grid_DataBinding()
Grid_InitializeLayout()
Grid_DataBinding()
Grid_InitializeLayout()
Page_Load()
BtnSearch_Click()
Grid_DataBinding()
Grid_InitializeLayout()

Then when you click to go to the next page:
OnInit()
Grid_InitializeDataSource()
Grid_DataBinding()
Grid_InitializeLayout()
Grid_DataBinding()
Grid_InitializeLayout()
Grid_DataBinding()
Grid_InitializeLayout()
Page_Load()
Grid_PageIndexChanged()

The problem I'm having is that since InitializeDataSource is happening before Page_Load the view and filter criteria haven't been loaded back from the page yet so it first fetches the initial data.  Then it fetches the data again with the selected criteria.  Is there a way to get InitializeDataSource to happen after Page_Load?  If i change it to only fetch 1 row in the InitializeDataSource paging and it displays an empty grid.

Parents
  • 28464
    posted

    Hello,

    Unfortunately controlling when InitializeDataSource fires is not possible, since this is the idea of the InitializeDataSource event in the first place - it gets automatically called by the grid whenever it needs data. The lifecycle of the page before and after postback is different, because after postback the grid needs to restore its state (LoadViewState event) and this gets executed prior to Page_Load. This is needed so that the grid can fire its respective events, get its state before Page_Load, etc.

    In cases like what you have, maybe you need _not_ use the automatica InitializeDataSource event, but rather manually rebind the grid in the respective lifecycles of the page, when needed.

    More info on databinding and how it affects the grid can be found in the following blog post:

    http://blogs.infragistics.com/blogs/tony_lombardo/archive/2008/01/29/demystifying-infragistics-webgrid-databinding.aspx

    HTH,

Reply Children