Make links different color in the datagrid

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Make links different color in the datagrid

    Hi.

    I'm using the standard datagrid control in my ASP.NET page. I have the
    latest version and all service packs of the framework installed. I am
    using the property builder to create my grid. My question is simple:
    How do I make the links in different cells adopt a specific CSS class?

    For instance, my header row in set to maroon and my links set to white.
    This makes the sortable columns headings display nicely (white on
    maroon background). But if I try to use a link somewhere else in my
    grid (ie. a Hyperlink column) then it also appears as white on a WHITE
    background.

    How do I make the links in the header row use CSS class .linkHeader, but
    make the links in the hyperlink column use .linkStandard? I tried the
    following but obviously it doesn't work:

    <asp:HyperLinkColumn Text="..." DataNavigateUrlField="master_id_account"
    DataNavigateUrlFormatString="Edit.aspx?masterIdAcc ount={0}"
    CssClass="linkStandard"></asp:HyperLinkColumn>

    ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property
    named 'CssClass'.]

    Mike
    Mike Chamberlain Guest

  2. Similar Questions and Discussions

    1. removal of border color for image links
      "thysta11" webforumsuser@macromedia.com wrote: Try the "IE Link Scrubber" extension available the DW Exchange (the MM site). -- Dan...
    2. Changing Individual Text Links Font color
      I need to change the color of some of my Text Links to a different color than that of my page properties. I knew at one point in time how to do...
    3. links in text field - change color on hover
      is there a way to make the links in a text field have a css equivalent of a:hover?
    4. Resetting "Visited" links to "links" color when new browser opens
      HELP! This should be simple, but I can't find info: In using CSS for font color for text hyperlinks, I have mine set so that the "links" are a...
    5. how to make url links on a bitmap?
      i'm having problem on bitmaps on how to put a link on it. could somebody help?
  3. #2

    Default Re: Make links different color in the datagrid

    Mike Chamberlain wrote:
    > Hi.
    >
    > I'm using the standard datagrid control in my ASP.NET page. I have the
    > latest version and all service packs of the framework installed. I am
    > using the property builder to create my grid. My question is simple:
    > How do I make the links in different cells adopt a specific CSS class?
    >
    > For instance, my header row in set to maroon and my links set to white.
    > This makes the sortable columns headings display nicely (white on
    > maroon background). But if I try to use a link somewhere else in my
    > grid (ie. a Hyperlink column) then it also appears as white on a WHITE
    > background.
    >
    > How do I make the links in the header row use CSS class .linkHeader, but
    > make the links in the hyperlink column use .linkStandard? I tried the
    > following but obviously it doesn't work:
    >
    > <asp:HyperLinkColumn Text="..." DataNavigateUrlField="master_id_account"
    > DataNavigateUrlFormatString="Edit.aspx?masterIdAcc ount={0}"
    > CssClass="linkStandard"></asp:HyperLinkColumn>
    >
    > ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property
    > named 'CssClass'.]
    >
    > Mike
    I found a partial workaround myself. First set the UseAccessibleHeader
    property of the grid to True, which tells it to render the table
    properly (using <TH> tags for the header cells rather than <TD> - why
    this isn't the default is beyond me). Then, two styles can be defined

    TH A { color:white; }
    TD A { color:maroon; }

    which works fine for now. But what happens if I want to have a link of
    one color in one Hyperlink column, and one of a different color in another?

    Any suggestions appreciated.

    Mike
    Mike Chamberlain Guest

  4. #3

    Default Re: Make links different color in the datagrid

    Mike Chamberlain wrote:
    > Hi.
    >
    > I'm using the standard datagrid control in my ASP.NET page. I have
    > the latest version and all service packs of the framework installed. I am
    > using the property builder to create my grid. My question is
    > simple: How do I make the links in different cells adopt a specific
    > CSS class?
    > For instance, my header row in set to maroon and my links set to
    > white. This makes the sortable columns headings display nicely
    > (white on maroon background). But if I try to use a link somewhere
    > else in my grid (ie. a Hyperlink column) then it also appears as
    > white on a WHITE background.
    >
    > How do I make the links in the header row use CSS class .linkHeader,
    > but make the links in the hyperlink column use .linkStandard? I
    > tried the following but obviously it doesn't work:
    >
    > <asp:HyperLinkColumn Text="..."
    > DataNavigateUrlField="master_id_account"
    > DataNavigateUrlFormatString="Edit.aspx?masterIdAcc ount={0}"
    > CssClass="linkStandard"></asp:HyperLinkColumn>
    > ['System.Web.UI.WebControls.HyperLinkColumn' does not have a property
    > named 'CssClass'.]
    >
    > Mike
    If the other columns don't contain links, you can set the CssClass property
    of the ItemStyle and AlternatingItemStyle.

    --

    Riki


    Riki Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139