Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I use a master page. In the following code I am trying to change the color of a button control which is inside a panel.

It is not working. How to make it work.

XML
<asp:UpdatePanel ID="dd" runat="server" UpdateMode="Conditional">
               <ContentTemplate>
               <asp:Button ID="Button5" runat="server"  Text='Herbal-Internal' Class="stylebutton" Font-Size="Small" BackColor="ControlLightLight" CausesValidation="false" OnClick="btnherbal_click" ForeColor="#666666" Style=" cursor:pointer;  font-family:Verdana;  font-weight:normal;  margin-top:28px; margin-left:0px; " BorderStyle="None" />
               </ContentTemplate>
               </asp:UpdatePanel>



CSS
.stylebutton:hover
  {
   color: white;
   background-color  :Red;
  }
Posted
Updated 10-May-17 6:17am

set styles as below
ASP.NET
<asp:button id="Button5" runat="server" text="Herbal-Internal" class="stylebutton" causesvalidation="false" onclick="btnherbal_click" xmlns:asp="#unknown" />

your css:
CSS
.stylebutton {
    cursor: pointer;
    font-family: Verdana;
    font-weight: normal;
    margin-top: 28px;
    margin-left: 0px;
    border-style: none;
    color: #666666;
    background-color: white;
}
.stylebutton:hover {
    cursor: pointer;
    font-family: Verdana;
    font-weight: normal;
    margin-top: 28px;
    margin-left: 0px;
    border-style: none;
    color: white;
    background-color: Red;
}
 
Share this answer
 
For me it's working.Please see the below demo.

LIVE DEMO: JSFiddle
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 3-May-14 4:19am    
I am using asp.net where it is not working.
Sampath Lokuge 3-May-14 4:23am    
Can't be.At the end it generates pure html know ? Check it with chrome dev tools to identify what's going there ? :(

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