apply to lable run diffrent font and border in asp.net?

Sagarp
Posted by Sagarp under ASP.NET category on | Views : 2482
aspx page
<%@ Page language="c#" Codebehind="grettings.aspx.cs" AutoEventWireup="false" Inherits="day8.grettings" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>grettings</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 88px" runat="server"
Width="456px" Height="56px" Font-Bold="True" Font-Size="XX-Large" BackColor="MintCream">HAPPY BIRHDAY </asp:Label>
<asp:DropDownList id="DropDownList3" style="Z-INDEX: 104; LEFT: 408px; POSITION: absolute; TOP: 240px"
runat="server">
<asp:ListItem Value="red">red</asp:ListItem>
<asp:ListItem Value="pink">pink</asp:ListItem>
<asp:ListItem Value="brown">brown</asp:ListItem>
<asp:ListItem Value="yellow">yellow</asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList id="DropDownList2" style="Z-INDEX: 103; LEFT: 40px; POSITION: absolute; TOP: 240px"
runat="server" AutoPostBack="True"></asp:DropDownList>
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 248px"
runat="server" Width="87px" BackColor="Olive" AutoPostBack="True" ForeColor="#400040">
<asp:ListItem Value="cyan">cyan</asp:ListItem>
<asp:ListItem Value="red">red</asp:ListItem>
<asp:ListItem Value="blue">blue</asp:ListItem>
<asp:ListItem Value="yellow">yellow</asp:ListItem>
<asp:ListItem Value="green">green</asp:ListItem>
<asp:ListItem Value="brown">brown</asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:Label id="Label3" style="Z-INDEX: 105; LEFT: 136px; POSITION: absolute; TOP: 336px" runat="server"
Font-Bold="True" BackColor="Olive" ForeColor="Blue">BORDER STYLE</asp:Label>
<asp:DropDownList id="ddlborder" style="Z-INDEX: 106; LEFT: 344px; POSITION: absolute; TOP: 320px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="dotted">dotted</asp:ListItem>
<asp:ListItem Value="solid">solid</asp:ListItem>
</asp:DropDownList></form>
</body>
</HTML>
.cs code
private void Page_Load(object sender, System.EventArgs e)
{
InstalledFontCollection fc=new InstalledFontCollection();

foreach(FontFamily ff in fc.Families)
{
this.DropDownList2.Items.Add(ff.Name);
}
this.Label1.Font.Name=this.DropDownList2.SelectedItem.Text;
this.Label1.ForeColor=Color.FromName(this.DropDownList1.SelectedItem.Text);
this.Label1.BackColor=Color.FromName(this.DropDownList3.SelectedItem.Text);




}



private void DropDownList3_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

// private void DropDownList4_SelectedIndexChanged(object sender, System.EventArgs e)
// {
// // this.Label1.BorderStyle=(BorderStyle)Enum.Parse(typeof(BorderStyle),DropDownList4.SelectedItem.Text);
// }

private void ddlborder_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.Label1.BorderStyle=(BorderStyle)Enum.Parse(typeof(BorderStyle),ddlborder.SelectedItem.Text);
}

private void DropDownList2_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

// private void DropDownList4_SelectedIndexChanged(object sender, System.EventArgs e)
// {
//
// }
}
}

Comments or Responses

Login to post response