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
400
Sample for LoadOnDemand grid
posted

hello,

where I can find a saple code for Grid.

I set Grid as

Browser="Xml"

ViewType="Hierarchical"

LoadOnDemand="Xml"

And added following code

         protected void myDataGrid_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e)
        {
            this.myDataGrid.DataSource = GetGridData();
        }

 protected void myDataGrid_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)

{

                e.Layout.Bands[0].DataKeyField = "User_UID";
                e.Layout.Bands[1].DataKeyField = "info_UID";

}

In GetGridData() function I fetch data from two tables of SQL database , fill dataset and define relations for this dataset.

This code works well but While debugging I found that when I click '+' sign on grid to view child rows, InitializeDataSource event fired again and it fetch data again from database.

I am confused whether it is correct behavior or not.Because for every '+' click it is loading data from SQL server .

Can any one guide me how to initialize data source for   Hierarchical and  LoadOnDemand="Xml" grid.

Or where I can find good example related to this?

Thanks

Shital

 

 

Parents
  • 2907
    posted

    I think this is correct behavior. InitializeDatasource would be triggered in each server trip.

     

    If you want to avoid SQL Database call then you need to store that data into Session variable.

     

    It means Use GetGridData() to fetch data and store that value in Session. Then use Session data to bind with grid in subsequent server trips.

Reply Children