Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

I am trying to change the color of link button when mouse over but it is not working :

This is my code :

XML
<style type="text/css">
       .simple
       {
           color: Red;
       }
       .simple:hover
       {
           color: #1A0006;
       }
   </style>

XML
<table width="100px" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td valign="top" style="width: 40px">
                                <asp:LinkButton CssClass="simple" ID="LinkButton2" ValidationGroup="culture" Text="العربية"
                                    runat="server" ForeColor="Black" Style="text-decoration: none;"></asp:LinkButton>
                            </td>
                            <td valign="bottom" runat="server" id="borders" style="width: 20px;">
                                <img src="images/Capture.PNG" />
                            </td>
                            <td valign="top" style="width: 40px">
                                <asp:LinkButton CssClass="simple" ID="LinkButton1" ValidationGroup="culture" Text="ENGLISH"
                                    runat="server" ForeColor="Black" Style="text-decoration: none"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>


Please help .
Posted
Updated 10-May-17 5:10am
v2

Remove Forecolor property

and add following !important, so it will take this style only not the inheritated one...

CSS
<style type="text/css">
       .simple
       {
           color: Red !important;
       }
       .simple:hover
       {
           color: #1A0006 !important;
       }
   </style>


enjoy
 
Share this answer
 
v2
Use javascript to assign css on mouse events over the button.
 
Share this answer
 
TRY THIS IS WORKING.......



function LinkBtnMouseOver(e) {
debugger;
e.className = 'clsHomePgLinkBtnMouseOver';
e.ForeColor = "red"
}
function LinkBtnMouseOut(e) {
e.className = 'clsHomePgLinkBtnNormal';
e.ForeColor = "green"
}




.clsHomePgLinkBtnNormal { color: blue;}
.clsHomePgLinkBtnMouseOver { color: red;}


<asp:linkbutton id="lnkbtnProvider" runat="server" text="<%# Eval(" provider")%&gt;"="" font-size="10pt" onmouseover="LinkBtnMouseOver(this)" onmouseout="LinkBtnMouseOut(this)" xmlns:asp="#unknown">

This is working.....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900