Hi,
I want to change the cell background color of parent grid as well as child band grid depend upon the cell value. For e.g. If cell value is critical change the background color to Red. Can anyone help me in this?
Thanks,
Mits
Hi Mits,
Rado's suggestion will work so long as you do not have multiple children on the same level. You could just check the level and only do it for level 1, not 0 (the parent view). I actually would check the value off of the Value property. That should be an int or date or whatever rather than string. To change the css class, just set it. e.Row.Items[2].CssClass = "custom";
One other option for only having this event fire on children would be to not add the event to the WHDG, but rather handle WHDG row island created and add the even to the grid there if its band is the child band.
-Dave
You should be able to distinguish the band level in InitializeRow event handler like this:
var BandLevel = ((ContainerGridRecord)e.Row).Level;
Hi David,
Thanks for quick reply. I am doing it inside InitializeRow event however the problem is it is checking all the rows first all parent rows and than child row. Is there anyway we can check only child band rows not the parent one. I am checking a condition for child band that if cell value of 2nd column is 1 than change its background color to red however this is also changing the background color of parent grid cells as well. So is there any way we can seperate parent and child band grid? Also if possible can you give a small example of how to change the cssclass of perticular cell inside IntializeRow event?
Right now i am checking the cell value with this script e.Row.Items[2].Text.ToString();.
Is this ok or any better way is there to check row values?
You should handle InitializeRow for the WebHierarchicalDataGrid. This will fire for all rows. Then, examine the cell value and assign a css class that contains the styling you desire. You will need this css class already defined somewhere.
regards,David Young