Overriding a style for the HyperlinkColumn in my datagrid: Please help me.

Discussion in 'ASP .Net Datagrid Control' started by SStory, Oct 28, 2003.

  1. SStory

    SStory Guest

    I have a style sheet for my site. It has various classes in it.
    It has <A: styles defined for all anchor tags.

    I have a datagrid in ASP.NET with a stylesheet linked to the page.

    It defines links as yellow which is what I normally won't but in this case I
    want to override the link color and can't seem to do it.

    I set the forecolor in itemstyle prop. But it doesn't work.

    Any ideas?

    Shane
    SStory, Oct 28, 2003
    #1
    1. Advertising

  2. SStory

    SStory Guest

    more detailed info on my problem :

    Have a data grid--for simplicity's sake defined as follows.
    just look at hyperlinkcolumn definition.

    <asp:datagrid id="grid" runat="server" Width="680px"
    CssClass="smallblacktext" DataKeyField="jobid" AllowPaging="True"
    AutoGenerateColumns="False">
    <asp:HyperLinkColumn DataNavigateUrlField="Email"
    DataNavigateUrlFormatString="mailto:{0}" DataTextField="email"
    HeaderText="Rep Email">
    <ItemStyle ForeColor="Blue" Font-Names="Arial"
    ></ItemStyle>

    </asp:HyperLinkColumn>
    </asp:datagrid>

    as you can see I am trying to override with forecolor="blue" because my grid
    has a white background

    styles.css contains this
    and I want it that way for 80% of my pages; and I have other styles in there
    that I want on all my pages. How can I override this for a HyperLinkColumn?
    A:link {
    text-decoration: none;
    font-size: 8pt;
    color: #ffff00;
    }

    A:visited {
    text-decoration: none;
    font-size: 8pt;
    color: #ffda00;
    }

    A:active {
    text-decoration: none;
    font-size: 8pt;
    color: #FFFF00;
    }

    A:hover {
    text-decoration: underline;
    font-size: 8pt;
    color: #FFFFFF;

    "SStory" <> wrote in message
    news:%...
    > I have a style sheet for my site. It has various classes in it.
    > It has <A: styles defined for all anchor tags.
    >
    > I have a datagrid in ASP.NET with a stylesheet linked to the page.
    >
    > It defines links as yellow which is what I normally won't but in this case

    I
    > want to override the link color and can't seem to do it.
    >
    > I set the forecolor in itemstyle prop. But it doesn't work.
    >
    > Any ideas?
    >
    > Shane
    >
    >
    >
    SStory, Oct 29, 2003
    #2
    1. Advertising

  3. SStory

    David Guest

    In article <#>, SStory wrote:
    > more detailed info on my problem :
    >
    > Have a data grid--for simplicity's sake defined as follows.
    > just look at hyperlinkcolumn definition.
    >
    ><asp:datagrid id="grid" runat="server" Width="680px"
    > CssClass="smallblacktext" DataKeyField="jobid" AllowPaging="True"
    > AutoGenerateColumns="False">
    > <asp:HyperLinkColumn DataNavigateUrlField="Email"
    > DataNavigateUrlFormatString="mailto:{0}" DataTextField="email"
    > HeaderText="Rep Email">


    <asp:HyperLinkColumn ... ItemStyle-CssClass="MyHlStyle" />

    and in the stylesheet

    ..MyHlStyle A:link, .MyHlStyle A:visited
    {
    color: purple;
    font-size: 128pt
    }


    or whatever you want. That won't affect your normal <A> tags, just the
    ones inside your specific hyperlink column.





    --
    David
    dfoster at
    hotpop dot com
    David, Oct 29, 2003
    #3
  4. SStory

    SStory Guest

    Hey man you are great!!!
    I have been all over the world for an answer to this and no one has
    responded!

    Thanks so much for the response! Works great! As you can tell I am new to
    CSS.

    Shane
    "David" <dfoster@127.0.0.1> wrote in message
    news:...
    > In article <#>, SStory wrote:
    > > more detailed info on my problem :
    > >
    > > Have a data grid--for simplicity's sake defined as follows.
    > > just look at hyperlinkcolumn definition.
    > >
    > ><asp:datagrid id="grid" runat="server" Width="680px"
    > > CssClass="smallblacktext" DataKeyField="jobid" AllowPaging="True"
    > > AutoGenerateColumns="False">
    > > <asp:HyperLinkColumn DataNavigateUrlField="Email"
    > > DataNavigateUrlFormatString="mailto:{0}" DataTextField="email"
    > > HeaderText="Rep Email">

    >
    > <asp:HyperLinkColumn ... ItemStyle-CssClass="MyHlStyle" />
    >
    > and in the stylesheet
    >
    > .MyHlStyle A:link, .MyHlStyle A:visited
    > {
    > color: purple;
    > font-size: 128pt
    > }
    >
    >
    > or whatever you want. That won't affect your normal <A> tags, just the
    > ones inside your specific hyperlink column.
    >
    >
    >
    >
    >
    > --
    > David
    > dfoster at
    > hotpop dot com
    SStory, Oct 30, 2003
    #4
    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. SStory
    Replies:
    3
    Views:
    2,412
    SStory
    Oct 30, 2003
  2. vtreddy
    Replies:
    0
    Views:
    2,053
    vtreddy
    Nov 6, 2003
  3. KK
    Replies:
    2
    Views:
    528
    Big Brian
    Oct 14, 2003
  4. Ken Varn
    Replies:
    0
    Views:
    430
    Ken Varn
    Apr 26, 2004
  5. Andrew Pasetti

    help calling a function from within a datagrid hyperlinkcolumn

    Andrew Pasetti, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    149
    Philip Q [MVP]
    Jan 12, 2005
Loading...

Share This Page