Assign CSS to DataGrid header

Discussion in 'ASP .Net Datagrid Control' started by Maziar Aflatoun, Dec 20, 2004.

  1. Hi everyone,

    I have a DataGrid with sort functionality enabled so that users can sort
    each column by clicking on the column name. Can someone please tell me how
    I can add CSS to my headers? no matter what I do I can't get class='' to
    appear in my <a ...class=""></a>

    Example

    I want to apply it to HeaderText="Name"
    <asp:TemplateColumn HeaderText="Name" SortExpression="Name">
    <HeaderStyle Font-Bold="True" CssClass="normtext"></HeaderStyle>
    <ItemTemplate>
    <asp:label id="lblName" runat="server" CssClass="normtext"
    Font-Bold=False text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'/>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:textbox id="txtName" CssClass="textbox1" runat="server"
    Columns="30" text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'/>
    </EditItemTemplate>
    </asp:TemplateColumn>

    I want in to appear in <a below...
    <a href="javascript:__doPostBack('dgOpportunities$_ctl1$_ctl0','')">Name</a>

    Thank you
    Maz.
     
    Maziar Aflatoun, Dec 20, 2004
    #1
    1. Advertisements

  2. Maziar Aflatoun wrote:
    > Hi everyone,
    >
    > I have a DataGrid with sort functionality enabled so that users can sort
    > each column by clicking on the column name. Can someone please tell me how
    > I can add CSS to my headers? no matter what I do I can't get class='' to
    > appear in my <a ...class=""></a>


    This CSS works fine for me:

    ..normtext a:visited,a:active,a:link
    {
    text-decoration: none;
    color: #DDDD00;
    }

    ..normtext a:hover
    {
    text-decoration: underline;
    }

    ,where normtext is CssClass in <HeaderStyle>

    --
    Peter Markusek
     
    Peter Markusek, Dec 21, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maziar Aflatoun

    CSS in DataGrid Header

    Maziar Aflatoun, Dec 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,627
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Dec 20, 2004
  2. Leor Amikam
    Replies:
    4
    Views:
    7,563
    Eliyahu Goldin
    Jul 10, 2005
  3. batista
    Replies:
    1
    Views:
    6,302
    Patrick.O.Ige
    Feb 16, 2006
  4. mlt
    Replies:
    2
    Views:
    1,137
    Jean-Marc Bourguet
    Jan 31, 2009
  5. djc
    Replies:
    2
    Views:
    258
  6. AlainCD
    Replies:
    0
    Views:
    360
    AlainCD
    Jan 12, 2006
  7. Henrik
    Replies:
    1
    Views:
    648
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  8. datagrid having row header and column header

    , Jul 13, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    291
Loading...