DataGrid Hyperlink Columns Color

Discussion in 'ASP.NET / ASP.NET Core' started by pimpnosis, Mar 16, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a datagrid with two columns: TempID and Name. The Name column is a hyperlink column and the TempID column is a bound column that is invisible. Both columns are populated programmically. I am having problems with changing the hyperlink color of the Name column. It defaults to the 'a' class and I cannot change it. So, how do I change the hyperlink class of a hyperlink column? thank you.
     
  2. use the ItemDataBound event, locate the anchor tag and change it's properties..

    if you throw the code my way i'll do it for you.

    ----
    Brian H. Madsen
    Microsoft SQL Server IG Perth - Organiser
    http://www.sqlserver.org.au
     
  3. I think an even better option is to assign a CSS class to the whole datagrid (using CssClass="" as an attribute). Then in your CSS you can assign colors to all links in that table. For instance:


    Make the datagrid CssClass="MyGrid"


    Then in your CSS style sheet do:


    .MyGrid a { color: #FF0000; }


    to make the links red. Note that this only works if you want to change the whole column. If you want to dynamically color each link you'll have to do it Brian's way.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page