HTMLServerControlFormat.aspx

  1. <%@ Page Language="C#" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4.   
  5. <script runat="server">  
  6.     protected void Button1_Click(object sender, System.EventArgs e) {  
  7.         Div1.Style["Color"] = "White";  
  8.         Div1.InnerText = "Division Changed";  
  9.         Div1.Style["height"] = "250px";  
  10.         Div1.Style["width"] = "250px";  
  11.         Div1.Style["background-color"] = "Crimson";  
  12.         Div1.Style["border-style"] = "double";  
  13.         Div1.Style["border-color"] = "HotPink";  
  14.         Div1.Style["font-size"] = "large";  
  15.         Div1.Style["text-align"] = "center";  
  16.           
  17.     }  
  18. </script>  
  19.   
  20. <html xmlns="http://www.w3.org/1999/xhtml">  
  21. <head runat="server">  
  22.     <title>asp.net HTML server control example: how to format (design and style) programmatically</title>  
  23. </head>  
  24. <body>  
  25.     <form id="form1" runat="server">  
  26.     <div>  
  27.         <h2 style="color:Teal">HTML server control example: Design and Style</h2>  
  28.         <div id="Div1" runat="server">  
  29.             Hi this is a HTML server control: Div  
  30.         </div>  
  31.         <br />  
  32.         <asp:Button   
  33.             runat="server"   
  34.             Text="Format the Division"   
  35.             OnClick="Button1_Click"  
  36.             Font-Bold="true"  
  37.             ForeColor="Green"  
  38.             />  
  39.     </div>  
  40.     </form>  
  41. </body>  
  42. </html>  




0 comments:

Post a Comment