I have a detail table view inside a master table, and I wish that I can handle the event when I click on the expand/collapse icon so that I am program behind. I wonder if it is possible to control the eventhandler of expand/collapse detail table view
6 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 18 Sep 2008, 03:45 AM
Hi Han,
You can either use the ItemCommand event or ItemDataBound event for this purpose.
CS:
or
Thanks
Shinu
You can either use the ItemCommand event or ItemDataBound event for this purpose.
CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == "ExpandCollapse") |
{ |
} |
} |
or
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
if (item.Expanded) |
{ |
} |
} |
} |
Thanks
Shinu
0

Han
Top achievements
Rank 1
answered on 18 Sep 2008, 02:41 PM
Thank you very much. It has been a great help. :)
0

Shinu
Top achievements
Rank 2
answered on 19 Sep 2008, 07:10 AM
Hi Han,
You can also refer the following help articles to get more details on accessing the Detailtables/items in the code behind.
Traversing detail tables/items in Telerik RadGrid
Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound
Cheers
Shinu.
You can also refer the following help articles to get more details on accessing the Detailtables/items in the code behind.
Traversing detail tables/items in Telerik RadGrid
Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound
Cheers
Shinu.
0

Eric
Top achievements
Rank 1
answered on 26 Sep 2008, 02:43 AM
I have a grid with 3 levels of heirarchy. What I want is that whenever I open the first level of the heirarchy, I wanted the child nodes to expand as well. How do I do this?
0

Shinu
Top achievements
Rank 2
answered on 26 Sep 2008, 03:32 AM
Hi Eric,
Try the following code snippet to achieve the desired scenario.
CS:
Thanks
Shinu.
Try the following code snippet to achieve the desired scenario.
CS:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach (GridDataItem item in RadGrid1.MasterTableView.Items) |
{ |
if (item.Expanded) |
{ |
GridTableView nestedView = ((GridDataItem)item).ChildItem.NestedTableViews[0]; |
foreach (GridItem childitem in nestedView.Items) |
{ |
childitem.Expanded = true; |
} |
} |
} |
} |
Thanks
Shinu.
0

Eric
Top achievements
Rank 1
answered on 26 Sep 2008, 03:53 AM
Thanks Shinu for your quick response. It worked although it rendered the expand/collapse action of the middle node moot- as the mother node above it dictates whether it is expanded or collapsed.