I have a project need dynamic create multiple grids based on a value in collection object. I need use Grid_NeedDataSource to bind grid. In Grid_NeedDataSource event I call a method BindGrid(). In OnInit event I have following code:
protected override void OnInit(EventArgs e)
{
Collection categories = GetCategories();
foreach (String category in categories)
{
DefindGridStructure(category);
}
}
The method DefindGridStructure(category) will create a datagrid based on category value.
void rgGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
BindGrid(CategoryKey);
}
My question is how can I get Category value in rgGrid_NeedDataSource event. I can't use viewstate value since it will be always the last value of the collection.