Datagrid ButtonColumn - LinkButton -- how to remove underline?

  • Thread starter Thread starter KatB
  • Start date Start date
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
 
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
 
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
 
Martin, guess I'm too tired to work. Your suggestion worked great once
I read it correctly!


Thanks, Kat
 
Back
Top