Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 CSS Class not working with Hyperlink Column

Author  Topic 

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-02-23 : 08:25:21
Inside my DataGrid's Columns tag I have:

<asp:HyperLinkColumn Text="[ Go ]" DataNavigateUrlField="RedirectPage" NavigateUrl="{0}" ItemStyle-CssClass="gobuttonlink"></asp:HyperLinkColumn>

However, my class "gobuttonlink" is not being applied to the link text. Anyone know how to accomplish this?

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-02-23 : 08:46:43
<td class="gobuttonlink"><a href="EnterNewApp.aspx">[ Go ]</a></td>

ok so my next question is how do I get the CSS class to set for the <a> tag instead of the <td> tag?
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-02-23 : 08:52:14
>>However, my class "gobuttonlink" is not being applied to the link text.

what HTML is generated for this table cell? What do you need it to be? I am not sure if you need help with the ASP.NET part (getting the HTML output you need) or the HTML/CSS part (getting the style you want applied).

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-02-23 : 08:56:07
ah -- that answers my question. And you answered it six minutes before I asked! not bad.

Using a HyperLinkColumn, I am not sure that you can apply a class to the <A> tag.

However, you could simply define your style sheet like this:

TD.goButtonLink A { .... }
TD.goButtonLink A:hover { .... }
TD.goButtonLink A:visited { .... }
..etc..

(or maybe rename the class "linkColumn" or "goButtonColumn" or something like that).

that way, all child "A" elements of a "TD" will get the style you want applied.
Go to Top of Page

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-02-23 : 09:05:04
hmm I never knew CSS could do something like that. I'll have to try that out. Thanks.
Go to Top of Page

lino_sql
Starting Member

3 Posts

Posted - 2006-03-02 : 03:50:21
Your CSS "gobuttonlink" is not for the mark <a> but the mark <td>.
I agree jsmith8858's method.


A Chinese Boy 24 ages
Go to Top of Page
   

- Advertisement -