Groups | Blog | Home
all groups > asp.net webcontrols > november 2004 >

asp.net webcontrols : Format Hyperlink in DataGrid


Alan Z. Scharf
11/20/2004 1:58:05 PM
Hi,

I'd like to format a hyperlink column in datagrid

1. Without underline, and
2. Change color on mouseover

Are there any format settings for that or is code required.

If code is required, can you refer me to some examples?

Thanks.

Alan

Ken Cox [Microsoft MVP]
11/20/2004 2:39:46 PM
Hi Alan,

You can do that sort of thing by embedding Style tags inside the Head
portion of the HTML. Here's a sample:

<style>
a { text-decoration :none }
a:hover { color:red; text-transform:uppercase; }
</style>

Click the Styles category here for more:

http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/a.asp

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto


[quoted text, click to view]
Alan Z. Scharf
11/20/2004 5:24:28 PM
Ken,

Thanks very much. That was incredibly easy!

The site is very valuable also.

Regards,

Alan

[quoted text, click to view]

Alan Z. Scharf
11/22/2004 9:30:14 AM
Ken

I changed from hyperlink to LinkButton with Select command in order to trap
event. Text value comes from database column.

Is there a way to control Hover foreground color on linkbutton?

I triedvarious things with A.linkButton: hover, but couldn't get it.

Note: The linkbutton is a DataGrid column.

Thanks very much.

Regards,

Alan



[quoted text, click to view]

Ken Cox [Microsoft MVP]
11/22/2004 8:52:00 PM
Hi Alan,

It should be the same as before:

A:hover { TEXT-TRANSFORM: uppercase; COLOR: red }

Can you show us a sample of the rendered HTML?

Ken

[quoted text, click to view]
Alan Z. Scharf
11/23/2004 5:26:33 PM
Ken,

Thanks again for your reply.

Here's what I'm doing within <HEAD/>. It worked for datagrid HyperLink
Column, but not for HyperLink Button set to Select command.

The hyperlink itself works, but is always default blue on mouseover.

Thanks.

Alan

<HTML>
<HEAD>
<title>Manager Reviews</title>
<meta content="True" name="vs_snapToGrid">
<meta content="True" name="vs_showGrid">
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="WebStylePermal.CSS" type="text/css" rel="stylesheet">
<LINK href="webMenuStylePermal.css" type="text/css" rel="stylesheet">
<style>
a { text-decoration :none }
a:hover { color:red; text-transform:uppercase; }
</style>
</HEAD>

<body MS_POSITIONING="GridLayout">......................

[quoted text, click to view]

Ken Cox [Microsoft MVP]
11/23/2004 6:07:33 PM
Hi Alan,

Could you browse to the page in IE, do View > Source and show some of the
rendered HTML for the problem grid? this shouldn't be difficult.

BTW, is it possible that one of the other stylesheets is overriding
something? Are you using a CSSClass value in the datagrid or its columns?

Thanks,

Ken

[quoted text, click to view]
Alan Z. Scharf
11/24/2004 2:59:41 AM
Ken

I redid the datagrid and the linkbutton mouseover works fine using the
method you originally gave me.

That seemed the most logical thing to do since you indicated it should
really work.

Something must have gotten trashed somewhere.

Thanks again for your help!

Regards,

Alan

[quoted text, click to view]

AddThis Social Bookmark Button