Page

How to change asp.net Button style programmatically

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    protected void Button2_Click(object sender, System.EventArgs e)  
    {  
        Button1.Font.Size = FontUnit.Medium;  
        Button1.ForeColor = System.Drawing.Color.OrangeRed;  
        Button1.Font.Bold = true;  
        Button1.Height = 50;  
        Button1.Font.Italic = true;  
           
    }  
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>How to set, change Button style programmatically</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2 style="color:Navy">Button Example: Style</h2>  
        <asp:Button   
             ID="Button1"   
             runat="server"   
             Text="Test Button Style"  
             />  
        <br /><br />  
        <asp:Button   
             ID="Button2"   
             runat="server"   
             Text="Change Button Style"  
             OnClick="Button2_Click"  
             />  
    </div>  
    </form>  
</body>  
</html>  

No comments:

Post a Comment