Friday, June 18, 2010

Speeding up RadGrids

If you can, turn viewstate off

HierarchyLoadMode="ServerOnDemand"

Do your data load for the top level parent table in The NeedDataSource Event
if (!e.IsFromDetailTable)
{
grd.DataSource = DAL.Practice.Catalog.GetMasterCatalogSuppliers();
}

Load the child table data in the _OnDetailTableDataBind event
//Get the id of the parent item
GridDataItem gridParentDataItem = e.DetailTableView.ParentItem as GridDataItem;
int brandID = gridParentDataItem.GetColumnInt32("BrandID");
//Note that the GetColumnInt32 is an Extension Method I wrote, you won't have it

// bind the detail grid
grd.MasterTableView.DetailTables[0].DataSource = Get...(brandID);

No comments:

Post a Comment