issue with ASP.Net Linkbutton and CSS class (visited)

1.8k Views Asked by At

I have an asp.net (.Net Framework 4.0) page with a gridview in it which contains linkbuttons. I set the cssclass property of the linkbuttons to make sure, the Color of the text changes when the link is being clicked (visited). Unfortunately that doesn't work... when i click on the linkbutton, the Color changes, then the postback occures and when i go back to that page, the linkbutton has the original Color :-( (tested with IE10, in IE8 and Firefox the Color even changes to the standard-link Color - not the Color i set, it also changes back immediately).

I tried it with Asp:Hyperlink which works, but i have many pages in my web with linkbuttons and wanted to avoid changing every page...

This is my code:

<asp:LinkButton ID="lnkDetails" runat="server" Text='<%# eval("str_Betreff") %>'
CssClass="westsitelinkbutton" OnClick="lnkDetails_Click"></asp:LinkButton>

This is the css code:

.westsitelinkbutton a:visited
{
color: #FFFFFF;
}

And here is the code within "lnkDetails_Click":

Public Sub lnkDetails_Click(ByVal sender As Object, ByVal e As EventArgs)
    Try
        Dim btn As LinkButton = CType(sender, LinkButton)
        Dim row As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow)

        Response.Redirect("mitarbeiter_gesendet_details.aspx?id=" & gvGesendeteObjekte.DataKeys(row.RowIndex).Value.ToString())
    Catch ex As Exception
        objFunctions.ShowAlert("fehler", ex.Message, ClientScript, Page)
    End Try
End Sub

Can anyone help me with this issue please?

Kind regards,

Sabrina

0

There are 0 best solutions below