Hi Telerik,
i am searching for the best approach to expand all items in a grid.
It is a 5 Level hierarchy with dynamically created columns, which should be set in editmode.
The ItemCreated and Databound Event have to be fired.
Do you have a simple way to do this?
Thanks for helping!
KR
Lars
At the moment i set all items of the first level in editmode and expand the first level.
For expanding i use following code:
i am searching for the best approach to expand all items in a grid.
It is a 5 Level hierarchy with dynamically created columns, which should be set in editmode.
The ItemCreated and Databound Event have to be fired.
Do you have a simple way to do this?
Thanks for helping!
KR
Lars
At the moment i set all items of the first level in editmode and expand the first level.
For expanding i use following code:
protected
void
RadGridHierarchy_PreRender(
object
sender, EventArgs e)
{
if
(_expandedItem !=
null
&& _expandedItem.Expanded)
{
if
(_expandedItem.HasChildItems)
{
foreach
(GridTableView view
in
_expandedItem.ChildItem.NestedTableViews)
{
foreach
(GridDataItem item
in
view.Items)
{
item.Edit =
true
;
}
view.Rebind();
}
}
}
//Edit on all Items in Level 1
for
(
int
i = 0; i < RadGridHierarchy.MasterTableView.Items.Count; i++)
{
RadGridHierarchy.EditIndexes.Add(i);
RadGridHierarchy.EditIndexes.Add(RadGridHierarchy.MasterTableView.Items[i].ItemIndex);
}
}
protected
void
RadGridHierarchy_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExpandCollapseCommandName)
{
_expandedItem = (GridDataItem)e.Item;
SaveGridValues();
if
(_expandedItem.Expanded)
{
_expandedItem =
null
;
}
}
}