Hi,
I am trying to apply some custom styles to rows based on values that are present in their child rows. I can only get this to work correctly if i have the HierarchyDefaultExpanded property set to true. By doing this, the radgrid looks very cluttered. Basically, i need to find out if there is a way to tell if a row has been expanded or not.
My code is below:
The problem is that when the row is not expanded, the count is 0.
0 is a valid count of rows as well, as some rows will not have any items beneath them, and I want their style to also change. Is their someway of finding out all the childitems of a row without expanding the row?
I already tried setting the HeiarchyLoadMode for the child table to be client but that didnt help either.
I basically need two things:
1. A way of knowing whether or not the row is expanded
2. The child items of the row when it is not expanded
Thanks,
Fayez
I am trying to apply some custom styles to rows based on values that are present in their child rows. I can only get this to work correctly if i have the HierarchyDefaultExpanded property set to true. By doing this, the radgrid looks very cluttered. Basically, i need to find out if there is a way to tell if a row has been expanded or not.
My code is below:
void RadGrid1_PreRender(object sender, EventArgs e) | |
{ | |
foreach (GridDataItem itm in RadGrid1.Items) | |
{ | |
if (itm.OwnerTableView.DataSourceID == "JobCodesSource") | |
{ | |
//Go through each of the items in there | |
int numChildRows = itm.ChildItem.NestedTableViews[0].Items.Count; | |
int numChanged = 0; | |
foreach (GridDataItem childItm in itm.ChildItem.NestedTableViews[0].ItemsHierarchy) | |
{ | |
string TechName = "Bill Gates"; | |
if (childItm["TechnicianId"].Text != Techname) | |
{ | |
childItm.CssClass = "MyCustomRowClass"; | |
numChanged++; | |
} | |
TechniciansSource.SelectCommand = oldSelect; | |
} | |
if(numChanged == numChildRows) | |
itm.CssClass = "MyCustomRowClass"; | |
} | |
} | |
} |
The problem is that when the row is not expanded, the count is 0.
0 is a valid count of rows as well, as some rows will not have any items beneath them, and I want their style to also change. Is their someway of finding out all the childitems of a row without expanding the row?
I already tried setting the HeiarchyLoadMode for the child table to be client but that didnt help either.
I basically need two things:
1. A way of knowing whether or not the row is expanded
2. The child items of the row when it is not expanded
Thanks,
Fayez