Hi there folks! Please could anyone tell me how I can disable the underline of a hyperlink button server control of datagrid and similar controls ? I had used the following css code on the ItemStyle-CssClass which works for traditional hyperlinks to no avail. Thanks for the help:)

.tablecellhyperlinks
{
text-decoration: none;
DISPLAY: block;
}
ItemStyle-CssClass="tablecellhyperlinks"

Recommended Answers

All 9 Replies

if it is in a table you have to have
td .tablecellhyperlinks in your css file.

I tried it but it doesn't work.
:sad:

if it is in a table you have to have
td .tablecellhyperlinks in your css file.

my mistake for not concentrating while writing the post

try

.tablecellhyperlinks td

Thank you f1 fan for your replies.
The suggestion you made is not still working.

I do not know whether the structure of a datagrid control's hyperlink button rendering does qualify as and has the attribute of a valid table. It has no valid "tr" and "td" tags. :confused:

Below is an example of what I'm talking about

<asp:datagrid id="dgLocationLink" runat="server" Width="140px" OnItemDataBound="Grid_ItemClicked"
       BorderWidth="0px" CellPadding="1" AutoGenerateColumns="False" Height="168px" CssClass="DefaultDataGridStyle">
       <AlternatingItemStyle BackColor="#d7dce8"></AlternatingItemStyle>
       <HeaderStyle Font-Size="15px" Font-Bold="True"></HeaderStyle>
       <Columns>
        <asp:HyperLinkColumn ItemStyle-CssClass="tablecellhyperlinks" Target="iA" DataNavigateUrlField="dToYou"
         ItemStyle-BorderStyle="Groove" ItemStyle-BorderWidth="10" DataNavigateUrlFormatString="../alink1.aspx?idm={0}"
         DataTextField="dToYou" HeaderText="You">
         <HeaderStyle Height="40px" BackColor="#6b83c6"></HeaderStyle>
         <ItemStyle Font-Size="20px" Height="40px"></ItemStyle>
        </asp:HyperLinkColumn>
       </Columns>
      </asp:datagrid>

while this is the css

.tablecellhyperlinks1 TD
{
text-decoration: none;
DISPLAY: block;
}
a.tablecellhyperlinks:link 
{
    text-decoration: none;
}

Thanks for the reply Hollystyles.
I believe you saw the current post. Do I change any variable or parameter in the datagrid code/schema. If no is the answer then your suggestion did not work.:sad:

a.tablecellhyperlinks:link 
{
    text-decoration: none;
}

well this sill work for any hyperlinks anywhere on the page:

a:link
{
    text-decoration: none;
}

lets start with that and see what you get.

Yes this works. Although with not so clean results but at least it works. so what next. Thanks

well this sill work for any hyperlinks anywhere on the page:

a:link
{
    text-decoration: none;
}

lets start with that and see what you get.

this is very useful for me..thanks!
i didn't use table or whatsoever..just a simple text and it works. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.