How to Set or Change Label Text ForeColor(Font Color) Programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to This Label ForeColor(Font Color) will change when clicking the Button.

3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to  ForeColor BlueViolet
->Also change Button two Text property to  ForeColor DarkOrange
Your Design Window should look like this 
Label Forecolor(Text,Font Color) Set or Change Programmatically







4.Double click on Button1(ForeColor BlueViolet Button) to get the code behind->Write this code
5. Double click on Button2(ForeColor DarkOrange Button) to get the code behind->Write this code
 6.Click F5 to run your project.
Label ForeColor(Text,Font) Set or Change Programmatically








Label ForeColor(Text,Font) Set or Change Programmatically










Label ForeColor(Text,Font) Set or Change Programmatically
 

No comments:

Post a Comment