CreateAndApplyCSSStyle.aspx

  1. <%@ Page Language="C#" AutoEventWireup="true" %>  
  2.   
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  4. <script runat="server">  
  5.     protected void Button1_Click(object sender, System.EventArgs e)  
  6.     {  
  7.         BulletedList1.Style.Add("Padding", "10px 25px 10px 55px");  
  8.         BulletedList1.Style.Add("font-family", "Courier New");  
  9.         BulletedList1.Style.Add("font-size", "x-large");  
  10.         BulletedList1.Style.Add("font-style", "italic");  
  11.         BulletedList1.Style.Add("text-decoration", "underline");  
  12.         BulletedList1.Style.Add("border", "2px dotted darkred");  
  13.         BulletedList1.Style.Add("background-color", "pink");  
  14.         BulletedList1.Style.Add("color", "deeppink");  
  15.     }  
  16. </script>  
  17.   
  18. <html xmlns="http://www.w3.org/1999/xhtml">  
  19. <head id="Head1" runat="server">  
  20.     <title>How to create and apply CSS style programmatically in asp.net control</title>  
  21. </head>  
  22. <body>  
  23.     <form id="form1" runat="server">  
  24.     <div>  
  25.         <h2 style="color:MidnightBlue; font-style:italic;">  
  26.             How to create and apply CSS style  
  27.             <br /> programmatically in asp.net control  
  28.         </h2>  
  29.         <hr width="450" align="left" color="SkyBlue"/>  
  30.         <asp:BulletedList  
  31.              ID="BulletedList1"  
  32.              runat="server"  
  33.              Width="500"  
  34.              BackColor="Crimson"  
  35.              ForeColor="Snow"  
  36.              >  
  37.              <asp:ListItem>Crimson</asp:ListItem>  
  38.              <asp:ListItem>MidnightBlue</asp:ListItem>  
  39.              <asp:ListItem>CornFlower</asp:ListItem>  
  40.              <asp:ListItem>DarkSalmon</asp:ListItem>  
  41.              <asp:ListItem>IndianRed</asp:ListItem>  
  42.              <asp:ListItem>OliveDrab</asp:ListItem>  
  43.         </asp:BulletedList>  
  44.         <asp:Button   
  45.             ID="Button1"  
  46.             runat="server"  
  47.             OnClick="Button1_Click"  
  48.             Text="Create And Apply CSS Style In BulletedList"  
  49.             Height="45"  
  50.             Font-Bold="true"  
  51.             ForeColor="DarkBlue"  
  52.             />  
  53.     </div>  
  54.     </form>  
  55. </body>  
  56. </html>  




0 comments:

Post a Comment