Monday, 18 March 2013

CSS: Change the HyperLink style programmatically

In the CSS file add this:



a.HyperLinkUnselected
{
    text-decoration: none;
    color: #FF0000;
    background-color: white;
}

a.HyperLinkUnselected:Hover
{
    background-color:white;
    color:Black
    text-decoration: underline;
}

a.HyperLinkSelected
{
    background-color:white;
    color:Black
    text-decoration: underline;
    font-weight:bold;
}



From the code behind file add the css class to HyperLink:


if (currentPage == i)
h.CssClass = "HyperLinkSelected";
else
h.CssClass = "HyperLinkUnselected";

No comments:

Post a Comment