Webster Velasco
Top achievements
Rank 2
Webster Velasco
asked on 30 Apr 2010, 08:45 AM
hi
how cn i change the back color of the row where i expanded a detail table?
thanks and regards
webster velasco
how cn i change the back color of the row where i expanded a detail table?
thanks and regards
webster velasco
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 30 Apr 2010, 09:22 AM
Hello,
Try the following client side code in "OnHierarchyExpanded" event to change the background color of row, when expanding.
Client code:
<script type="text/javascript"> |
function HierarchyExpanded(sender, eventargs) { |
eventargs.get_gridDataItem().get_element().style.backgroundColor = "red"; |
eventargs.get_gridDataItem().get_element().style.backgroundImage = "none"; |
} |
</script> |
-Shinu.
0
Webster Velasco
Top achievements
Rank 2
answered on 30 Apr 2010, 10:11 AM
ur code isnt firing
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Apr 2010, 10:55 AM
Hello,
I missed to mention that, I am using HierarchyLoadMode as "ClientSide" in my application and since the client side event fires when expanding the row. If you are using ServerBind option, then try the following code and see whether it helps.
C#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.ExpandCollapseCommandName) |
{ |
(e.Item as GridDataItem).BackColor = System.Drawing.Color.Red; |
} |
} |
-Shinu.
0
Webster Velasco
Top achievements
Rank 2
answered on 30 Apr 2010, 11:07 AM
thanks shinu..
how can i revert the backcolr if its not expanded anymore?
how can i revert the backcolr if its not expanded anymore?
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2010, 01:52 PM
Hi,
I have modified the above code in order to achieve the required functionality. Give a try with this code.
CS:
Regards,
Princy.
I have modified the above code in order to achieve the required functionality. Give a try with this code.
CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == RadGrid.ExpandCollapseCommandName) |
{ |
GridDataItem item = (GridDataItem) e.Item; |
if (item.Expanded) |
{ |
if (item.ItemIndex % 2 == 0) |
{ |
item.BackColor = System.Drawing.Color.Transparent; |
item.CssClass = "rgRow"; |
} |
else |
{ |
item.BackColor = System.Drawing.Color.Transparent; |
item.CssClass = "rgAltRow"; |
} |
} |
else |
{ |
item.BackColor = System.Drawing.Color.Red; |
} |
} |
} |
Regards,
Princy.
0
paul
Top achievements
Rank 1
answered on 24 Feb 2011, 09:07 AM
Hi Shinu,
I know this is an old thread but I hope I could still get some help.
I tried this code and when i firebug i can see that the background -color attribute has been set to red but the grid still shows the same background color.
My grid has load mode = Client and the event is firing after expanded but the color doesnt change;
I know this is an old thread but I hope I could still get some help.
I tried this code and when i firebug i can see that the background -color attribute has been set to red but the grid still shows the same background color.
My grid has load mode = Client and the event is firing after expanded but the color doesnt change;