Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Changing hyperlink style in the datagrid using CSS

Posted on 2004-10-21
Medium Priority
Last Modified: 2012-08-13
I want to change the header hyperlink which is automatically created as i have enable sorting in the datagrid. the problem is that default hyperlink of css class has been applied to the header links of datagrid and i dont want that. I need to change the style.... here is the code

<asp:BoundColumn DataField="NAME" SortExpression="Name" HeaderText="Student Name"></asp:BoundColumn>

the Student Name is the hyperlink on the header of the datagrid and i need to change its style. Plesase give me the css class and where to apply that class to change the header hyperlink .

Also i have enabled paging in the datagrid... and below pages hyperlink are show 1 2 3 4 5 ... and hyperlinks again in default colors... and i dont want that... please do let me know how to change that also... actually the problem is to change the hyperlink styles in the datagrid in short.

Thanks and Regards
Question by:faruquis
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 28

Expert Comment

ID: 12378394
Hi faruquis,

use this

            <asp:BoundColumn DataField="NAME" SortExpression="Name" HeaderText="Student Name">

               <HeaderStyle CssClass="Your css class name">

               <FooterStyle CssClass="Your css class name">



Author Comment

ID: 12378423
no sir.. it isnt working... my class name is datagridlinks and i aplied the class as told by you... the generated code is this... and the class is not applied to the <a href...... take a look

<td class="datagridlinks"><a href="javascript:__doPostBack('reportData$_ctl2$_ctl0','')">Student Name</a></td><td>
LVL 28

Expert Comment

ID: 12378463
you have to declared the class like this
.LNnTxt1 { FONT-SIZE: 11px; COLOR: #000099; FONT-FAMILY: arial, verdana, helvetica, sans-serif; }
A.LNnTxt1:link {       FONT-SIZE: 11px; COLOR: #000099; FONT-FAMILY: arial, verdana, helvetica, sans-serif;}
A.LNnTxt1:visited {      FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: arial, verdana, helvetica, sans-serif; }
A.LNnTxt1:active {      COLOR: #ff0000; }
A.LNnTxt1:hover {      COLOR: #990000; TEXT-DECORATION: none; }

and then add LNnTxt1 as a class name to the header/footerstyle


Author Comment

ID: 12387488
this is not a valid answer.. have been able to find a valid solution and implementted that also.. thanks for you time buddy.. here is the solution


Accepted Solution

modulo earned 0 total points
ID: 12734862
PAQed with points refunded (50)

Community Support Moderator

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question