<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CSS Friendly Control Adapters</title><link>http://forums.asp.net/1018.aspx</link><description>Discuss the CSS Friendly Control Adapters sample project, ask questions, post bugs, etc</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1592222.aspx</link><pubDate>Fri, 23 Feb 2007 17:57:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1592222</guid><dc:creator>Puhfista</dc:creator><author>Puhfista</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1592222.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1592222</wfw:commentRss><description>My EmptyDataTemplate/EmptyDataText doesn't seem to work with the new Gridview either. Any chance of that being implemented in new releases?</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1506657.aspx</link><pubDate>Fri, 22 Dec 2006 17:01:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1506657</guid><dc:creator>Christopher_G_Lewis</dc:creator><author>Christopher_G_Lewis</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1506657.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1506657</wfw:commentRss><description>&lt;p&gt;Thanks so much for your work on this - It's excellent.&lt;/p&gt;
&lt;p&gt;C# code:&lt;/p&gt;&lt;pre class=coloredcode&gt;&lt;span class=cmt&gt;////if ((field.ItemStyle != null) &amp;amp;&amp;amp; (!String.IsNullOrEmpty(field.ItemStyle.CssClass))) {
////  if (!String.IsNullOrEmpty(cell.CssClass)) {
////    cell.CssClass += " ";
////  }
////  cell.CssClass += field.ItemStyle.CssClass;
////}

//Updated from http://forums.asp.net/thread/1478997.aspx&lt;/span&gt;
TableItemStyle style;
&lt;span class=kwd&gt;if&lt;/span&gt; (tableSection == &lt;span class=st&gt;"thead"&lt;/span&gt;) {
	style = field.HeaderStyle;
} &lt;span class=kwd&gt;else if&lt;/span&gt; (tableSection == &lt;span class=st&gt;"tfoot"&lt;/span&gt;) {
	style = field.FooterStyle;
} &lt;span class=kwd&gt;else&lt;/span&gt; {
	style = field.ItemStyle;
}
&lt;span class=kwd&gt;if&lt;/span&gt; ((style != &lt;span class=kwd&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (!String.IsNullOrEmpty(style.CssClass))) {
	cell.CssClass = String.Format(&lt;span class=st&gt;"{0} {1}"&lt;/span&gt;, cell.CssClass, style.CssClass).Trim();
}
&lt;span class=cmt&gt;//Uncomment the following block of code if you want to add style attributes to individual cells.&lt;/span&gt;
CssStyleCollection styles = style.GetStyleAttributes(&lt;span class=kwd&gt;this&lt;/span&gt;.Control);

&lt;span class=kwd&gt;foreach&lt;/span&gt; (String strKey &lt;span class=kwd&gt;in&lt;/span&gt; styles.Keys) {
	cell.Style.Add(strKey, styles[strKey]);
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480636.aspx</link><pubDate>Wed, 29 Nov 2006 17:15:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480636</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480636.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480636</wfw:commentRss><description>&lt;p&gt;BTW, I didn't think of it initially, but the code can very simply be extended to apply &amp;lt;tfoot&amp;gt; styles as well, by substituting the following code for the "If...Then" block.&amp;nbsp; In fact, for completeness, I'd definitely recommend using this one.&lt;/p&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;If&lt;/span&gt; (tableSection = &lt;span class=st&gt;"thead"&lt;/span&gt;) &lt;span class=kwd&gt;Then&lt;/span&gt;
   style = field.HeaderStyle
&lt;span class=kwd&gt;ElseIf&lt;/span&gt; (tableSection = &lt;span class=st&gt;"tfoot"&lt;/span&gt;) &lt;span class=kwd&gt;Then&lt;/span&gt;
   style = field.FooterStyle
&lt;span class=kwd&gt;Else&lt;/span&gt;
   style = field.ItemStyle
&lt;span class=kwd&gt;End If&lt;/span&gt;
&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480630.aspx</link><pubDate>Wed, 29 Nov 2006 17:12:07 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480630</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480630.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480630</wfw:commentRss><description>&lt;p&gt;The code I posted above is completely tested, with both classes and inline styles,&amp;nbsp;in both the HeaderStyle and ItemStyle.&lt;/p&gt;
&lt;p&gt;I completely agree with you about the "community thing", and I always love to give back, because I have gotten some of my best and most important code snippets from people posting on forums and blogs.&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480618.aspx</link><pubDate>Wed, 29 Nov 2006 17:03:57 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480618</guid><dc:creator>Russ Helfand</dc:creator><author>Russ Helfand</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480618.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480618</wfw:commentRss><description>&lt;p&gt;Excellent.&amp;nbsp; Can you confirm that you are able to get the right classes onto the right elements in your HTML now?&amp;nbsp; It seems like that is the case but I want to make certain it is so.&lt;/p&gt;
&lt;p&gt;The bottom line is that it's important for developers like you to feel like it is possible to tweak the adapters between releases of the kit to quickly overcome deficiencies like this.&amp;nbsp; That we are able to discuss them and quickly post solutions publicly seems, to me, to be the hallmark of true community involvement/empowerment. I hope you agree.&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480598.aspx</link><pubDate>Wed, 29 Nov 2006 16:36:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480598</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480598.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480598</wfw:commentRss><description>&lt;p&gt;Hi Russ,&lt;/p&gt;
&lt;p&gt;Thank you for the response, and I do understand about not being able to promise when certain features will appear.&lt;/p&gt;
&lt;p&gt;I tested out your code snippet, and it did work.&amp;nbsp; However, since my code is in VB, I translated it, and then while I was at it, I added another piece of code to do cell style, in the same manner that you did the row styles.&amp;nbsp; (In a previous post I had described the need to do inline styles on individual cells.)&lt;/p&gt;
&lt;p&gt;Then, I came up with a sleeker way to add CSS classes, and then just went ahead and refactored entire WriteRows() function.&amp;nbsp; (Pasted below)&lt;/p&gt;
&lt;p&gt;I hope you get a chance to check it out, because I think there are some nice improvements here.&amp;nbsp; It's written in VB, but it is easy to translate to c#, I'd be happy to do it if you'd like.&lt;/p&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;Private Sub&lt;/span&gt; WriteRows(&lt;span class=kwd&gt;ByVal&lt;/span&gt; writer &lt;span class=kwd&gt;As&lt;/span&gt; HtmlTextWriter, &lt;span class=kwd&gt;ByVal&lt;/span&gt; gridView &lt;span class=kwd&gt;As&lt;/span&gt; GridView, &lt;span class=kwd&gt;ByVal&lt;/span&gt; rows &lt;span class=kwd&gt;As&lt;/span&gt; GridViewRowCollection, &lt;span class=kwd&gt;ByVal&lt;/span&gt; tableSection &lt;span class=kwd&gt;As String&lt;/span&gt;)

   &lt;span class=kwd&gt;If&lt;/span&gt; (rows.Count &amp;gt; 0) &lt;span class=kwd&gt;Then&lt;/span&gt;
      writer.WriteLine()
      writer.WriteBeginTag(tableSection)
      writer.Write(HtmlTextWriter.TagRightChar)
      writer.Indent += 1

      &lt;span class=kwd&gt;For Each&lt;/span&gt; row &lt;span class=kwd&gt;As&lt;/span&gt; GridViewRow &lt;span class=kwd&gt;In&lt;/span&gt; rows
         writer.WriteLine()
         writer.WriteBeginTag(&lt;span class=st&gt;"tr"&lt;/span&gt;)

         &lt;span class=kwd&gt;Dim&lt;/span&gt; className &lt;span class=kwd&gt;As String&lt;/span&gt; = GetRowClass(gridView, row)

         &lt;span class=kwd&gt;If&lt;/span&gt; (&lt;span class=kwd&gt;Not String&lt;/span&gt;.IsNullOrEmpty(className)) &lt;span class=kwd&gt;Then&lt;/span&gt;
            writer.WriteAttribute(&lt;span class=st&gt;"class"&lt;/span&gt;, className)
         &lt;span class=kwd&gt;End If&lt;/span&gt;

         &lt;span class=cmt&gt;'Uncomment the following block of code if you want to add arbitrary attributes.
&lt;/span&gt;         &lt;span class=kwd&gt;For Each&lt;/span&gt; key &lt;span class=kwd&gt;As String In&lt;/span&gt; row.Attributes.Keys
            writer.WriteAttribute(key, row.Attributes(key))
         &lt;span class=kwd&gt;Next&lt;/span&gt;

         writer.Write(HtmlTextWriter.TagRightChar)
         writer.Indent += 1

         &lt;span class=kwd&gt;For Each&lt;/span&gt; cell &lt;span class=kwd&gt;As&lt;/span&gt; TableCell &lt;span class=kwd&gt;In&lt;/span&gt; row.Cells
            &lt;span class=kwd&gt;Dim&lt;/span&gt; fieldCell &lt;span class=kwd&gt;As&lt;/span&gt; DataControlFieldCell = cell

            &lt;span class=kwd&gt;If&lt;/span&gt; ((fieldCell IsNot &lt;span class=kwd&gt;Nothing&lt;/span&gt;) &lt;span class=kwd&gt;AndAlso&lt;/span&gt; (fieldCell.ContainingField IsNot &lt;span class=kwd&gt;Nothing&lt;/span&gt;)) &lt;span class=kwd&gt;Then
               Dim&lt;/span&gt; field &lt;span class=kwd&gt;As&lt;/span&gt; DataControlField = fieldCell.ContainingField

               &lt;span class=kwd&gt;If&lt;/span&gt; (&lt;span class=kwd&gt;Not&lt;/span&gt; field.Visible) &lt;span class=kwd&gt;Then&lt;/span&gt;
                  cell.Visible = &lt;span class=kwd&gt;False
               End If

               Dim&lt;/span&gt; style &lt;span class=kwd&gt;As&lt;/span&gt; TableItemStyle

               &lt;span class=kwd&gt;If&lt;/span&gt; (tableSection = &lt;span class=st&gt;"thead"&lt;/span&gt;) &lt;span class=kwd&gt;Then&lt;/span&gt;
                  style = field.HeaderStyle
               &lt;span class=kwd&gt;Else&lt;/span&gt;
                  style = field.ItemStyle
               &lt;span class=kwd&gt;End If

               If&lt;/span&gt; ((style IsNot &lt;span class=kwd&gt;Nothing&lt;/span&gt;) &lt;span class=kwd&gt;AndAlso&lt;/span&gt; (&lt;span class=kwd&gt;Not String&lt;/span&gt;.IsNullOrEmpty(style.CssClass))) &lt;span class=kwd&gt;Then&lt;/span&gt;
                  cell.CssClass = &lt;span class=kwd&gt;String&lt;/span&gt;.Format(&lt;span class=st&gt;"{0} {1}"&lt;/span&gt;, cell.CssClass, style.CssClass).Trim()
               &lt;span class=kwd&gt;End If&lt;/span&gt;

               &lt;span class=cmt&gt;'Uncomment the following block of code if you want to add style attributes to individual cells.
&lt;/span&gt;               &lt;span class=kwd&gt;Dim&lt;/span&gt; styles &lt;span class=kwd&gt;As&lt;/span&gt; CssStyleCollection = style.GetStyleAttributes(&lt;span class=kwd&gt;Me&lt;/span&gt;.Control)

               &lt;span class=kwd&gt;For Each&lt;/span&gt; strKey &lt;span class=kwd&gt;As String In&lt;/span&gt; styles.Keys
                  cell.Style.Add(strKey, styles.Item(strKey))
               &lt;span class=kwd&gt;Next

            End If&lt;/span&gt;

            writer.WriteLine()
            cell.RenderControl(writer)
         &lt;span class=kwd&gt;Next&lt;/span&gt;

         writer.Indent -= 1
         writer.WriteLine()
         writer.WriteEndTag(&lt;span class=st&gt;"tr"&lt;/span&gt;)
      &lt;span class=kwd&gt;Next&lt;/span&gt;

      writer.Indent -= 1
      writer.WriteLine()
      writer.WriteEndTag(tableSection)
   &lt;span class=kwd&gt;End If

End Sub&lt;/span&gt;
&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480432.aspx</link><pubDate>Wed, 29 Nov 2006 14:40:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480432</guid><dc:creator>Russ Helfand</dc:creator><author>Russ Helfand</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480432.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480432</wfw:commentRss><description>&lt;p&gt;I can definitely consider this enhancement for a future rev.&amp;nbsp; I can't (as I'm sure you understand) modify the current bits.&amp;nbsp; That means you aren't going to see this show up in a new download of the kit in the predictable future.&amp;nbsp; So, let's turn our attention to what you and others can do today to achieve your goal.&lt;/p&gt;
&lt;p&gt;I need to "talk code" here for a little while.&amp;nbsp; Unfortunately, we have some readers who prefer C# and some who prefer VB and both sorts have been contributing to this thread.&amp;nbsp; I'm going illustrate my ideas here with C# but if VB readers need help, please post replies here and I'll whip up the equivalent solution in VB... though I bet most of you can do that translation work with enough patience!&lt;/p&gt;
&lt;p&gt;OK, I need folks to dig into the method named &lt;font size=2&gt;WriteRows in App_Code\Adapters\GridViewAdapter.cs.&amp;nbsp; Look around line 187 in &lt;a href="http://www.asp.net/CSSAdapters/srcviewer.aspx?inspect=%2fCSSAdapters%2fApp_Code%2fAdapters%2fGridViewAdapter.cs&amp;amp;notree=true"&gt;http://www.asp.net/CSSAdapters/srcviewer.aspx?inspect=%2fCSSAdapters%2fApp_Code%2fAdapters%2fGridViewAdapter.cs&amp;amp;notree=true&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;You should be able to test field.HeaderStyle to see if it is null.&amp;nbsp; If it isn't, and if if field.HeaderStyle.CssClass is not null and not empty then you might want to use it rather than the ItemStyle.CssClass depending on the value of tableSection (which is passed in).&amp;nbsp; If tableSection is "thead" then it makes sense to set up the cell with the HeaderStyle.CssClass if it exists. Since you already have the logic in the code for rendering field.ItemStyle.CssClass I'd recommend adding a few lines like it.&amp;nbsp; Here is something I wrote in Notepad but haven't tested.&amp;nbsp; Maybe someone could give it a try...&lt;/p&gt;
&lt;p&gt;if (tableSection == "thead")&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((field.HeaderStyle != null) &amp;amp;&amp;amp; (!String.IsNullOrEmpty(field.HeaderStyle.CssClass)))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!String.IsNullOrEmpty(cell.CssClass))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.CssClass += " ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.CssClass += field.HeaderStyle.CssClass;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((field.ItemStyle != null) &amp;amp;&amp;amp; (!String.IsNullOrEmpty(field.ItemStyle.CssClass)))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!String.IsNullOrEmpty(cell.CssClass))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.CssClass += " ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.CssClass += field.ItemStyle.CssClass;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&amp;nbsp;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1480231.aspx</link><pubDate>Wed, 29 Nov 2006 11:48:49 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1480231</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1480231.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1480231</wfw:commentRss><description>&lt;p&gt;Hi Russ,&lt;/p&gt;
&lt;p&gt;Did my explanation make sense?&amp;nbsp; Is that something that would be re-considered for inclusion (the ability to individually style header cells)?&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1479004.aspx</link><pubDate>Tue, 28 Nov 2006 15:26:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1479004</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1479004.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1479004</wfw:commentRss><description>&lt;p&gt;By the way, to set the width style on the &amp;lt;th&amp;gt; tags, I use the following Column definition, together with the code modification above.&lt;/p&gt;
&lt;blockquote&gt;&lt;font color=#0000ff size=2&gt;
&lt;p&gt;&amp;lt;&lt;/p&gt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;BoundField&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;DataField&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Field1"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;HeaderText&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Title"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;HeaderStyle-Width&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="19%"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;&lt;/font&gt;&lt;/blockquote&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1478997.aspx</link><pubDate>Tue, 28 Nov 2006 15:22:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1478997</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1478997.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1478997</wfw:commentRss><description>&lt;p&gt;I just wanted to add one more modification that I made to the extender, which may be useful to others.&amp;nbsp; It deviates a little bit from from strict CSS markup, so some people may not like it.&lt;/p&gt;
&lt;p&gt;Also, maybe there is a way to do the same thing without the code modifcation?&lt;/p&gt;
&lt;p&gt;On my site I need to display several small tables on several pages, both in the page and in user controls.&amp;nbsp; Thus, the CSS adapters are perfect.&amp;nbsp; However, one thing I like to do is to set the column widths (percentages) using a style attribute on the &amp;lt;th&amp;gt; tag, rather than using a class.&lt;/p&gt;
&lt;p&gt;There are a few reasons.&amp;nbsp; For one, all the style info&amp;nbsp;for the headers is already defined in the "global" CSS sheet, and the only thing that will be different is the width.&amp;nbsp; Creating an extra style sheet and incurring the overhead of all the extra class names just to set column&amp;nbsp;widths is not practical, and in my view takes the idea of separation of content and formatting beyond the reasonable.&lt;/p&gt;
&lt;p&gt;Plus, if you're talking about semantic coding I believe it is much more&amp;nbsp;descriptive to see &lt;strong&gt;&amp;lt;th style="width:20%"&amp;gt;&lt;/strong&gt; than &lt;strong&gt;&amp;lt;th class="total"&amp;gt;&lt;/strong&gt;, when the only thing the "total" class defines is the width.&amp;nbsp; Also, if the table is being used for its intended purpose -- display of tabular information -- rather than a page layout framework, then the width is something that is device-independent, especially if it is defined as a percentage.&lt;/p&gt;
&lt;p&gt;The reason I like defining the widths in the &amp;lt;thead&amp;gt; section, rather than adding to cell classes or styles in the &amp;lt;tbody&amp;gt;&amp;nbsp;is that it provides a very nice, descriptive layout in the code.&amp;nbsp; As far as web browser rendering, it is the most efficient way to do it, and prevents formatting errors maintainability problems caused by embedding width information into the body cells.&lt;/p&gt;
&lt;p&gt;The modification I made was a small change to the code that &lt;strong&gt;adk&lt;/strong&gt; wrote.&amp;nbsp; I have included the whole code snippet, and put my changes in bold.&amp;nbsp; (And translated to VB, of course.)&lt;/p&gt;&lt;pre class=coloredcode&gt;&lt;span class=kwd&gt;Dim&lt;/span&gt; i &lt;span class=kwd&gt;As Integer&lt;/span&gt; = 0

&lt;span class=kwd&gt;For Each&lt;/span&gt; col &lt;span class=kwd&gt;As&lt;/span&gt; DataControlField &lt;span class=kwd&gt;In&lt;/span&gt; gridView.Columns

   &lt;span class=kwd&gt;If&lt;/span&gt; (&lt;span class=kwd&gt;Not String&lt;/span&gt;.IsNullOrEmpty(col.HeaderStyle.CssClass)) &lt;span class=kwd&gt;Then&lt;/span&gt;
      gridView.HeaderRow.Cells(i).CssClass = col.HeaderStyle.CssClass
   &lt;span class=kwd&gt;End If

&lt;strong&gt;   If&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt; (col.HeaderStyle.Width &amp;lt;&amp;gt; &lt;span class=kwd&gt;Nothing&lt;/span&gt;) &lt;span class=kwd&gt;Then&lt;/span&gt;
      gridView.HeaderRow.Cells(i).Width = col.HeaderStyle.Width
   &lt;span class=kwd&gt;End If&lt;/span&gt;
&lt;/strong&gt;
   i += 1
&lt;span class=kwd&gt;Next&lt;/span&gt;
&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1478979.aspx</link><pubDate>Tue, 28 Nov 2006 14:58:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1478979</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1478979.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1478979</wfw:commentRss><description>(Sorry about the errors, this thing is not letting me edit my post)</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1478978.aspx</link><pubDate>Tue, 28 Nov 2006 14:56:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1478978</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1478978.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1478978</wfw:commentRss><description>&lt;p&gt;As far as HeaderStyle CssClass, I think we're talking about two different things.&lt;/p&gt;
&lt;p&gt;The HeaderStyle-CssClass can be set in the GridView tag or in the Column definition.&amp;nbsp; I use HeaderStyle-CssClass in the Coilumn definition, because I want to set the class name on each individual cell, like this: &lt;strong&gt;&amp;lt;th class="TheClass" scope="col"&amp;gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;That does not happen, and in fact&amp;nbsp;the class attribute is not rendered at all when I use the following column definition:&lt;/p&gt;&lt;font color=#0000ff size=2&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/font&gt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;BoundField&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;DataField&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Field1"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;HeaderText&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="Title"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;HeaderStyle-CssClass&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="TheClass"&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;/&amp;gt;&lt;/font&gt;
&lt;p&gt;The HeaderStyle-CssClass you are talking about is when you define it as part of the GridView tag, like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;&lt;font color=#800000 size=2&gt;asp&lt;/font&gt;&lt;font color=#0000ff size=2&gt;:&lt;/font&gt;&lt;font color=#800000 size=2&gt;GridView&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;ID&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="GridView1"&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;font color=#ff0000&gt;AutoGenerateColumns&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="false"&lt;/font&gt;&lt;font color=#000000 size=2&gt;&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;font color=#ff0000 size=2&gt;GridLines&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="None"&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;HeaderStyle-CssClass&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="TheClass"&lt;/font&gt;&lt;font color=#000000 size=2&gt; &lt;/font&gt;&lt;font color=#ff0000 size=2&gt;runat&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="server"&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;When you do that, instead of individually styling the column headers, it creates &lt;strong&gt;&amp;lt;tr class="TheClass"&amp;gt;&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1478849.aspx</link><pubDate>Tue, 28 Nov 2006 12:53:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1478849</guid><dc:creator>Russ Helfand</dc:creator><author>Russ Helfand</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1478849.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1478849</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://forums.asp.net/thread/1473749.aspx"&gt;http://forums.asp.net/thread/1473749.aspx&lt;/a&gt;&amp;nbsp;RTM is out, my friend... and it has all of these enhancements in it, including:&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:Arial;"&gt;&lt;strong&gt;&lt;font style="BACKGROUND-COLOR:#ffff00;"&gt;GridView&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:Arial;"&gt;&lt;br /&gt;&lt;font style="BACKGROUND-COLOR:#ffff00;"&gt;&amp;nbsp; Support HeaderStyle.CssClass, FooterStyle.CssClass and RowStyle.CssClass. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1478807.aspx</link><pubDate>Tue, 28 Nov 2006 12:21:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1478807</guid><dc:creator>speednet</dc:creator><author>speednet</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1478807.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1478807</wfw:commentRss><description>&lt;p&gt;These additions from adk and Liming are excellent, I hope they make it into the next version.&amp;nbsp; The one with the Header cell classes is critical, and it's actually how I found this thread --&amp;nbsp;Googling for such a thing.&lt;/p&gt;
&lt;p&gt;Some of these items have been included in the final release: table class, row class, and row attributres.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Header cell classes, ClientID, and caption have not been included yet -- will they make it into the next version?&lt;/p&gt;</description></item><item><title>Re: GridViewAdapter Beta 3.0 with added support for CssClass, ClientID, HeaderStyle-CssClass, row.CssClass, row.Attributes</title><link>http://forums.asp.net/thread/1458626.aspx</link><pubDate>Thu, 09 Nov 2006 11:39:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1458626</guid><dc:creator>Liming</dc:creator><author>Liming</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1458626.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1458626</wfw:commentRss><description>&lt;p&gt;good one adk. &lt;br /&gt;&lt;br /&gt;I want to add a few things I noticed on beta3.0 as well. &lt;br /&gt;&lt;br /&gt;first, if gridview has no rows, it should gerneate any table markup at all, (in my case, an empty table screw up the design) so in RenderContents method, check&lt;br /&gt;&lt;br /&gt;if (gridView != null &amp;amp;&amp;amp; gridView.Rows.Count&amp;gt;0)&amp;nbsp; instead of doing a simple null check&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;secondly, I needed to gerneate caption, which was not supported, so in RenderContent again, right above ArrayList rows = new ArrayList();&amp;nbsp; I added&lt;br /&gt;&lt;br /&gt;&amp;nbsp;if (gridView.Caption != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteLine();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //writer.WriteBeginTag("caption");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write(HtmlTextWriter.TagLeftChar);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write("caption");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write(HtmlTextWriter.TagRightChar);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.Write(gridView.Caption);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndTag("caption");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteLine();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>