Tuesday, 24 September 2013

ASPDOTNET BUTTON CONTROL EVENT CSS MANOHAR GOUD

9866550012


CSS AND ASP.NET

  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>  



 

 




ONSERVERCLICK on Button Control


  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_ServerClick(object sender, System.EventArgs e)  
  7.     {  
  8.         int ImageSize =(Int16) Image1.Height.Value;  
  9.         Image1.Height = ImageSize + 100;  
  10.         Label1.Text = "Image Height: " + Image1.Height.ToString();  
  11.     }  
  12. </script>  
  13.   
  14. <html xmlns="http://www.w3.org/1999/xhtml" >  
  15. <head id="Head1" runat="server">  
  16.     <title>How to use onserverclick event in HTML button control in asp.net</title>  
  17. </head>  
  18. <body>  
  19.     <form id="form1" runat="server">  
  20.     <div>  
  21.         <h2 style="color:Navy; font-style:italic;">HTML Server Control Example: Using onserverclick event</h2>  
  22.         <asp:Label   
  23.             ID="Label1"   
  24.             runat="server"  
  25.             Font-Bold="true"  
  26.             ForeColor="IndianRed"  
  27.             Font-Size="Larger"  
  28.             >  
  29.         </asp:Label>  
  30.         <br /><br />  
  31.         <asp:Image   
  32.             ID="Image1"   
  33.             runat="server"   
  34.             ImageUrl="~/Images/Image1.jpg"  
  35.             Height="250"  
  36.             />  
  37.         <br />  
  38.         <input   
  39.             type="button"   
  40.             id="Button1"   
  41.             value="Increase Image Size"   
  42.             runat="server"   
  43.             onserverclick="Button1_ServerClick"   
  44.             />  
  45.     </div>  
  46.     </form>  
  47. </body>  
  48. </html>  


 

 

 



Button Control as HTML SERVER CONTROL


  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_ServerClick(object sender, System.EventArgs e)  
  7.     {  
  8.         Label1.Text = "Hi! " + TextBox1.Text;  
  9.     }  
  10. </script>  
  11.   
  12. <html xmlns="http://www.w3.org/1999/xhtml" >  
  13. <head id="Head1" runat="server">  
  14.     <title>How to use button control as HTML server control in asp.net</title>  
  15. </head>  
  16. <body>  
  17.     <form id="form1" runat="server">  
  18.     <div>  
  19.         <h2 style="color:Navy; font-style:italic;">HTML Server Control Example: Using Button</h2>  
  20.         <asp:Label   
  21.             ID="Label1"   
  22.             runat="server"  
  23.             Font-Bold="true"  
  24.             ForeColor="DodgerBlue"  
  25.             Font-Size="Larger"  
  26.             >  
  27.         </asp:Label>  
  28.         <br /><br />  
  29.         <asp:Label   
  30.             ID="Label2"   
  31.             runat="server"  
  32.             Text="Name"  
  33.             Font-Bold="true"  
  34.             ForeColor="DeepPink"  
  35.             >  
  36.         </asp:Label>  
  37.         <asp:TextBox   
  38.             ID="TextBox1"  
  39.             runat="server"  
  40.             BackColor="PaleGoldenrod"  
  41.             ForeColor="DeepPink"  
  42.             >  
  43.         </asp:TextBox>  
  44.         <br />  
  45.         <input   
  46.             type="button"   
  47.             id="Button1"   
  48.             value="Submit"   
  49.             runat="server"   
  50.             onserverclick="Button1_ServerClick"   
  51.             />  
  52.     </div>  
  53.     </form>  
  54. </body>  
  55. </html> 



 

 

 




  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.   
  7. </script>  
  8.   
  9. <html xmlns="http://www.w3.org/1999/xhtml">  
  10. <head runat="server">  
  11.     <title>How to set default focus for a control in form</title>  
  12. </head>  
  13. <body>  
  14.     <form id="form1" runat="server" defaultfocus="TextBox2">  
  15.     <div>  
  16.         <h2 style="color:Navy">Form defaultfocus Property</h2>  
  17.         <asp:Label   
  18.              ID="Label1"   
  19.              runat="server"  
  20.              Font-Bold="true"  
  21.              ForeColor="DarkGreen"  
  22.              Text="Employee Name"  
  23.              >  
  24.         </asp:Label>  
  25.         <asp:TextBox   
  26.              ID="TextBox1"  
  27.              runat="server"  
  28.              BackColor="DarkGreen"  
  29.              >  
  30.         </asp:TextBox>  
  31.         <br />  
  32.         <asp:Label   
  33.              ID="Label2"   
  34.              runat="server"  
  35.              Font-Bold="true"  
  36.              ForeColor="DarkGreen"  
  37.              Text="National ID"  
  38.              >  
  39.         </asp:Label>  
  40.         <asp:TextBox   
  41.              ID="TextBox2"  
  42.              runat="server"  
  43.              BackColor="DarkGreen"  
  44.              >  
  45.         </asp:TextBox>  
  46.         <br /><br />  
  47.         <asp:Button   
  48.              ID="Button1"   
  49.              runat="server"  
  50.              Font-Bold="true"  
  51.              ForeColor="DarkGreen"  
  52.              Text="Submit"  
  53.              />  
  54.     </div>  
  55.     </form>  
  56. </body>  
  57. </html>  






  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 Page_Load(object sender, System.EventArgs e) {   
  7.         if(!this.IsPostBack)  
  8.         {  
  9.             string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));  
  10.             ListBox1.DataSource = borderStyleArray;  
  11.             ListBox1.DataBind();  
  12.         }  
  13.     }  
  14. </script>  
  15.   
  16. <html xmlns="http://www.w3.org/1999/xhtml">  
  17. <head id="Head1" runat="server">  
  18.     <title>How to get border style name list in asp.net</title>  
  19. </head>  
  20. <body>  
  21.     <form id="form1" runat="server">  
  22.     <div>  
  23.         <h2 style="color:Green">Get Border Style Name List</h2>  
  24.         <asp:Label   
  25.              ID="Label1"   
  26.              runat="server"  
  27.              Font-Bold="true"  
  28.              Text="Border Style"  
  29.              ForeColor="DodgerBlue"  
  30.              >  
  31.         </asp:Label>  
  32.         <br />  
  33.         <asp:ListBox   
  34.              ID="ListBox1"   
  35.              runat="server"  
  36.              BackColor="DodgerBlue"  
  37.              ForeColor="AliceBlue"  
  38.              >  
  39.         </asp:ListBox>  
  40.     </div>  
  41.     </form>  
  42. </body>  
  43. </html>