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.
Spoke to Infragistics and here is the code that actuall fixed my styling issue:
UltraWebGrid1.DisplayLayout.OptimizeCSSClassNamesOutput = Infragistics.WebUI.Shared.DefaultableBoolean.False;
Explanation given:
If you are using CSS style then you have to set the OptimizeCSSClassNamesOutput property to false to properly apply the CSS on the Grid. However, if you are using percentage width then there is a limitation that Grid with stationary margins set will not properly with percentage width, so you have to set it No.
For more information on this you can refer the following online help article at the link below:
Percentage Widths Used with Stationary Margins and/or Fixed Headers Limitation
<
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebGrid_Percentage_Widths_Used_with_Stationary_Margins_andor_Fixed_Headers_Limitation.html>
Looks like this is the answer: http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10026
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.
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-orderFor 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.htmlNOTE: 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
In VB.NET
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):
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):
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. :(