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
25
Ultrawebgrid 7.1 Style problem
posted

Hi,

I have recently upgraded my project to use Infragistics Ultrawebgrid version 7.1. The Style/formatting of the grid has been a problem since then for which I have not been able to find a consistent solution.

The major problem is that, the style for the grid is not being applied when we load the page for the first time. But if a postback happens on the page then the style is applied correctly (I am Not using the css files. Just setting the properties in the grid definition in the .aspx page). I have compared the source of the page before and after postback and noticed that after postback a style section (which is generated by the grid) is added to the page. I am not sure why this auto style section is not added on first loading.

Could someone please help or provide any pointers !!

Thanks in Advance.

Nikhil Garg.

Parents
  • 314
    posted

    You not alone. Same issue here. I upgraded and it looks like my styles are not being applied the first time page loads.

    I remember I had the same issue when I upgraded last time. However, I don't remember what fixed it. :(

Reply
  • 314
    posted in reply to Levon

    Looks like this is the answer: http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10026

    Summary

    Applications that used Cascading Style Sheets (CSS) in conjunction with WebGrid and WebCombo may not appear as expected from reading the CSS definition. This is most commonly encountered when upgrading an ASP.NET project to use NetAdvantage for .NET 2007 Volume 1 from an earlier version of the NetAdvantage for .NET toolset, but it can also happen with new web applications. This is caused by changes to WebGrid and WebCombo that are required to work with AppStylist for ASP.NET.

    Additional Information

    Prior to the release of NetAdvantage for .NET 2007 Volume 1, when using the CssClass properties on Style objects, WebGrid and WebCombo would determine what was the "lowest common" style for a particular element, and only apply that specific CssClass to that element. With the advent of the AppStylist for ASP.NET, we implemented the ability to have multiple CSS classes applied to the same element, and layer them in the proper order.

    In applying multiple CSS classes to the same element, standard HTML cascading rules are applied. This means that, if two rules have the same weight, origin and specificity, the latest rule specified is the one that takes precedence. For WebGrid and WebCombo, this means that if you are using setting multiple CssClass properties that can both apply to a specific element, they are applied in order that they are found in your CSS file, with the last one applied trumping any that were applied earlier in the file.

    For more information about CSS cascading order rules, please refer to the following link (neither authored nor maintained by Infragistics):
    http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order

    For a basic reference as to the order in which styles are applied to WebGrid and WebCombo, please refer to the WebGrid Style Inheritance article in our online help documentation for NetAdvantage for .NET 2007 Volume 1 for CLR 2.0 (this also applies to the CLR 1.x version):
    http://help.infragistics.com/Help/NetAdvantage/NET/2007.1/CLR2.0/html/WebGrid_Style_Inheritance.html

    NOTE: The current version of this document is not entirely accurate, due to additional changes in NetAdvantage for .NET 2007 Volume 1. The following two changes will be made to this document:
    - RowStyle no longer inherits from FrameStyle.
    - Band styles are applied immediately after their grid-level counterparts.

    For example, when considering the RowStyle and RowAltStyle at the grid and band level, these styles will be applied in the following order:
    .gridLevelRowStyleDefault
    .bandLevelRowStyleDefault
    .gridLevelRowAltStyleDefault
    .bandLevelRowStyleDefault

    Step-By-Step Example

    Consider the following scenario, where you have a WebGrid with the following properties set:

    In C#:
    ultraWebGrid1.DisplayLayout.RowStyleDefault.CssClass = “RowStyle”;
    ultraWebGrid1.DisplayLayout.RowAlternateStyleDefault.CssClass = “RowAltStyle”;
    ultraWebGrid1.DisplayLayout.HeaderStyleDefault.CssClass = “HeaderStyle”;

    In VB.NET

    UltraWebGrid1.DisplayLayout.RowStyleDefault.CssClass = “RowStyle”
    UltraWebGrid1.DisplayLayout.RowAlternateStyleDefault.CssClass = “RowAltStyle”
    UltraWebGrid1.DisplayLayout.HeaderStyleDefault.CssClass = “HeaderStyle”

    In the past, you could apply the following CSS style sheet, since the order where the classes are defined didn't matter.

    In CSS (not correct for 7.1):

    .RowAltStyle{ background-color: White; }
    .RowStyle{ background-color: Blue; }
    .HeaderStyle{ background-color: Green; }

    This will no longer work in NetAdvantage for .NET 2007 Volume 1 as it did before. Instead, all of your rows will have a blue background, while your headers would correctly have a green background.

    If you want your alternate rows to appear white, as noted in the RowAltStyle class, you should instead use the following CSS definition:

    In CSS (correct for 7.1):

    .RowStyle{ background-color: Blue; }
    .RowAltStyle{ background-color: White; }
    .HeaderStyle{ background-color: Green; }
Children