ASP.Net 2.0 Gridview and ItemRow Theming

Posted on 2006-04-13
Last Modified: 2008-02-01
Not really a problem, the setting the named skin for a gridview.  

I've got three types of Item rows, one aligned Left, one Right and one center.

Is there a way using the Theme to set these??

I"ve got the theme for the grid already and it works, but Can't find a way to set the ItemRow Style.
<asp:gridview runat="server" skinID="GridView"
            AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"  EnableSortingAndPagingCallbacks="True" PageSize="20">
        <RowStyle BackColor="#FFFBD6" Font-Names="Arial" Font-Size="8pt" ForeColor="Black" Wrap="False" />
        <HeaderStyle BackColor="Maroon" Font-Names="Arial" Font-Size="8pt" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" Wrap="False" />
        <SelectedRowStyle BackColor="LightGray" Font-Bold="True" />
        <FooterStyle BackColor="Maroon" BorderColor="White" Font-Bold="True" Font-Names="Arial" Font-Size="8pt" />
Question by:PTBNA
    1 Comment
    LVL 2

    Accepted Solution

    You can really only skin at the asp:gridview level. That said, I had a similar issue. I setup multiple skins for gridviews and associated gridviews to the appropriate skin using the SkinID attribute on the gridview tag. Then, for each skin, I associated an exclit CSS class to each gridview I was using. Then, in my CSS, I changed style for each of my rows accordingly.


    in my .skin file I might have the following:
      <asp:GridView SkinID="MainTable" AlternatingStyle-CssClass="AltRow" HeaderStyle-CssClass="HeaderRow"  />
      <asp:GridView SkinID="OtherTable" AlternatingStyle-CssClass="AltRow" HeaderStyle-CssClass="HeaderRow"  />

    in my .css file I might have the following:
      table.MainTable tr.AltRow
        background-color: #0f0f0f;

      table.OtherTable tr.AltRow
        background-color: #f9f9f9;

    and in my aspx file, I create the asp:GridView control using the appropriate skin id

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now