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. Advertising

  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. Advertising

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. Leor Amikam
    Replies:
    4
    Views:
    7,294
    Eliyahu Goldin
    Jul 10, 2005
  2. mlt
    Replies:
    2
    Views:
    916
    Jean-Marc Bourguet
    Jan 31, 2009
  3. djc
    Replies:
    2
    Views:
    164
  4. Henrik
    Replies:
    1
    Views:
    466
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  5. datagrid having row header and column header

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

Share This Page