Hi,
Do you have an example of conditional formatting on a rows' cells?
I want to change the backColor of the cell according to a comparison between that cell and another one.
Now, I also want to change the format of the cell's value. Meaning, the webGrid is bound to a dataTable which contains double numbers, and I wanna format it, so for example if I have 84.52 I wanna see 84.52% in the webGrid. Will it have any impact on the conditional formatting? (Since I'm comparing two numbers...)
Please advice,
Thanks
Maya
intel
Hello,
Yes, I think this is possible and relatively easy to implement. I believe a good place to start would be the InitializeRow grid event - it gets fired for each row that is currently being populated and contains all the information for its Cells, so you can check if a certain cell matches your criteria and change the style of some other cell based on that.
There are plenty of discussions on InitializeRow in this forum or in help - just do a search on "InitializeRow" and you will get a lot of sample code.
Hope this helps.
Thanks.
Can you please show me an example of hoe to format the cell from within that event? I mean - how to access a specific cell in the row, etc.
I found it :
UltraGridCell AvailCell = e.Row.Cells.FromKey("Avail");
double availVal = (double)AvailCell.Value;
AvailCell.Style.BackColor = Color.Red;
I was just writing back :) Glad I was able to help a bit and thanks for sharing your solutoin in public forums.