Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1060
Set RowStyle.BackColour within Ajax postback?
posted

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

Parents
No Data
Reply
  • 45049
    Suggested Answer
    posted

    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.

Children