Datagrid ButtonColumn - LinkButton -- how to remove underline?

K

KatB

Hi,

I'm building a datagrid with a column to show + or - signs for
expanding/collapsing child rows, etc. It works okay except since I'm
using a LinkButton column there is an underline below the
symbols...looks confusing. I tried applying a css style, but that
didn't take.

CType(dgCharge.Items(iCount).Cells(0).Controls(0), LinkButton).CssClass
= "buttonSyle"

I tried using a PushButton type which certainly looks better, but
apparently there is no method for changing the button's text property,
and there is with the LinkButton.

Am I missing the less-the-obvious?

Thanks, Kat
 
M

Martin Dechev

Hi,

The easiest way is wrapping the actual text of the link in a span with
style="text-decoration: none;". So from code you should:

buttonColumn1.DataTextFormatString = "<span style='text-decoration:
none;'>{0}</span>"

or in the aspx page set the corresponding attribute:

<... datatextformatstring="<span style='text-decoration:none;'>{0}</span>"
..../>

Hope this helps
Martin Dechev
ASP.NET MVP
 
K

KatB

Hi Martin,

When I added that to the line I provided, I get a "DataTextFormatString
is not a member of System.Web.UI.WebControl.LinkButton.

Obviously, I've got this in the wrong place. I also tried adding the
text-decoration: none to the CSS style, no luck.

Any other guidance?

Thanks, Kat
 
K

KatB

Martin, guess I'm too tired to work. Your suggestion worked great once
I read it correctly!


Thanks, Kat
 
Joined
Aug 24, 2007
Messages
1
Reaction score
0
set attribute of link button

set the attribute of link button as:

Font-Underline = "false"



it will solve the problem.

thanks

Prashant gupta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top