9866550012
CSS AND ASP.NET
- <%@ Page Language="C#" AutoEventWireup="true" %>
- <!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 Button1_Click(object sender, System.EventArgs e)
- {
- BulletedList1.Style.Add("Padding", "10px 25px 10px 55px");
- BulletedList1.Style.Add("font-family", "Courier New");
- BulletedList1.Style.Add("font-size", "x-large");
- BulletedList1.Style.Add("font-style", "italic");
- BulletedList1.Style.Add("text-decoration", "underline");
- BulletedList1.Style.Add("border", "2px dotted darkred");
- BulletedList1.Style.Add("background-color", "pink");
- BulletedList1.Style.Add("color", "deeppink");
- }
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>How to create and apply CSS style programmatically in asp.net control</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <h2 style="color:MidnightBlue; font-style:italic;">
- How to create and apply CSS style
- <br /> programmatically in asp.net control
- </h2>
- <hr width="450" align="left" color="SkyBlue"/>
- <asp:BulletedList
- ID="BulletedList1"
- runat="server"
- Width="500"
- BackColor="Crimson"
- ForeColor="Snow"
- >
- <asp:ListItem>Crimson</asp:ListItem>
- <asp:ListItem>MidnightBlue</asp:ListItem>
- <asp:ListItem>CornFlower</asp:ListItem>
- <asp:ListItem>DarkSalmon</asp:ListItem>
- <asp:ListItem>IndianRed</asp:ListItem>
- <asp:ListItem>OliveDrab</asp:ListItem>
- </asp:BulletedList>
- <asp:Button
- ID="Button1"
- runat="server"
- OnClick="Button1_Click"
- Text="Create And Apply CSS Style In BulletedList"
- Height="45"
- Font-Bold="true"
- ForeColor="DarkBlue"
- />
- </div>
- </form>
- </body>
- </html>
ONSERVERCLICK on Button Control
- <%@ 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 Button1_ServerClick(object sender, System.EventArgs e)
- {
- int ImageSize =(Int16) Image1.Height.Value;
- Image1.Height = ImageSize + 100;
- Label1.Text = "Image Height: " + Image1.Height.ToString();
- }
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head id="Head1" runat="server">
- <title>How to use onserverclick event in HTML button control in asp.net</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <h2 style="color:Navy; font-style:italic;">HTML Server Control Example: Using onserverclick event</h2>
- <asp:Label
- ID="Label1"
- runat="server"
- Font-Bold="true"
- ForeColor="IndianRed"
- Font-Size="Larger"
- >
- </asp:Label>
- <br /><br />
- <asp:Image
- ID="Image1"
- runat="server"
- ImageUrl="~/Images/Image1.jpg"
- Height="250"
- />
- <br />
- <input
- type="button"
- id="Button1"
- value="Increase Image Size"
- runat="server"
- onserverclick="Button1_ServerClick"
- />
- </div>
- </form>
- </body>
- </html>
Button Control as HTML SERVER CONTROL
- <%@ 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 Button1_ServerClick(object sender, System.EventArgs e)
- {
- Label1.Text = "Hi! " + TextBox1.Text;
- }
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head id="Head1" runat="server">
- <title>How to use button control as HTML server control in asp.net</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <h2 style="color:Navy; font-style:italic;">HTML Server Control Example: Using Button</h2>
- <asp:Label
- ID="Label1"
- runat="server"
- Font-Bold="true"
- ForeColor="DodgerBlue"
- Font-Size="Larger"
- >
- </asp:Label>
- <br /><br />
- <asp:Label
- ID="Label2"
- runat="server"
- Text="Name"
- Font-Bold="true"
- ForeColor="DeepPink"
- >
- </asp:Label>
- <asp:TextBox
- ID="TextBox1"
- runat="server"
- BackColor="PaleGoldenrod"
- ForeColor="DeepPink"
- >
- </asp:TextBox>
- <br />
- <input
- type="button"
- id="Button1"
- value="Submit"
- runat="server"
- onserverclick="Button1_ServerClick"
- />
- </div>
- </form>
- </body>
- </html>
- <%@ 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">
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>How to set default focus for a control in form</title>
- </head>
- <body>
- <form id="form1" runat="server" defaultfocus="TextBox2">
- <div>
- <h2 style="color:Navy">Form defaultfocus Property</h2>
- <asp:Label
- ID="Label1"
- runat="server"
- Font-Bold="true"
- ForeColor="DarkGreen"
- Text="Employee Name"
- >
- </asp:Label>
- <asp:TextBox
- ID="TextBox1"
- runat="server"
- BackColor="DarkGreen"
- >
- </asp:TextBox>
- <br />
- <asp:Label
- ID="Label2"
- runat="server"
- Font-Bold="true"
- ForeColor="DarkGreen"
- Text="National ID"
- >
- </asp:Label>
- <asp:TextBox
- ID="TextBox2"
- runat="server"
- BackColor="DarkGreen"
- >
- </asp:TextBox>
- <br /><br />
- <asp:Button
- ID="Button1"
- runat="server"
- Font-Bold="true"
- ForeColor="DarkGreen"
- Text="Submit"
- />
- </div>
- </form>
- </body>
- </html>
- <%@ 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 Page_Load(object sender, System.EventArgs e) {
- if(!this.IsPostBack)
- {
- string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
- ListBox1.DataSource = borderStyleArray;
- ListBox1.DataBind();
- }
- }
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>How to get border style name list in asp.net</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <h2 style="color:Green">Get Border Style Name List</h2>
- <asp:Label
- ID="Label1"
- runat="server"
- Font-Bold="true"
- Text="Border Style"
- ForeColor="DodgerBlue"
- >
- </asp:Label>
- <br />
- <asp:ListBox
- ID="ListBox1"
- runat="server"
- BackColor="DodgerBlue"
- ForeColor="AliceBlue"
- >
- </asp:ListBox>
- </div>
- </form>
- </body>
- </html>









No comments:
Post a Comment