Hi all. I'm using the latest UltrawebGrid 9.1 with browser=XML and LoadOnDemand set to XML as I want to minimize full postbacks as much as possible.
I need to be able to alter the background colour of the current row when certain columns contain certain values. I am putting code into the server side of UltraWebGrid1.UpdateRow
e.Row.Style.BackColor = Color.PaleGoldenrod
but this has no affect. I've also tried the same thing in the UpdateCell event (both of which are firing) - and still no luck.
Is there a way to achieve this?
Thanks in advance.
Jonathan
Jonathan,
Use CSS to style your grid instead in this scenario.
The reason this occurs is because, when you set most Style properties on most Infragistics ASP.NET controls, the control will render inline CSS to the HEAD section of the page to represent the style change. When using an AJAX callback (whether through WebGrid's built-in AJAX, our WebAsyncRefreshPanel, or Microsoft's UpdatePanel), this inline CSS can't be included.
By having a CSS class defined and already available on the client, you can change styles on the server and expect them to reflect on the client. For instance, you'd have a CSS style defined with a "background-color" entry that matches the Pale Goldenrod color, then set the e.Row.Style.CssClass property equal to the name of that CSS class.
Hi Vince, thanks for the quick reply...that solution sounded good...but I'm afraid I can't get it to work in practise.
I have defined a few cssClasses in my Stylesheet.css and in the InitialiseRow even (server side) I choose which cssclass to use as per your suggestion. This sets the background colour fo the rows that are loaded 1st time round - but it doesn't have any affect during an XML postback.
Any other ideas? Do I need to somehow handle the initialise row on the client side?
Thanks again,