Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,


i have a dropdownlist control.
in that control i have a list items like ARIAL,VARDANA,TIMES NEW ROMAN....like so on.
when i select one type and click the change button then my text will be chage into that selected desired font type.

please help to solve this.
Posted
Comments
What have you tried and where is the problem?

On dropdownlist SelectedIndex Changed Event
Font fnt = new Font(dropdownlist.SelectedItem.ToString(), 9);
textBox1.Font = fnt;
 
Share this answer
 
v2
Hi you can add following code on your dropdownlist control selectedindexchanged event
If you have lable on your page and you want to change its font style dynamically use following code

ASP.NET
<asp:Label ID="Label1" runat="server" Text="Label">Hi this is text</asp:Label>


C#
if (Label1.Style[HtmlTextWriterStyle.FontFamily] == null)

               Label1.Style.Add(HtmlTextWriterStyle.FontFamily, "TIMES NEW ROMAN");

           else
               Label1.Style[HtmlTextWriterStyle.FontFamily] = "Calibri";
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900