How to set or Change Label Control Height 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.From 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 Label Height Changing Example ->also set BackClor property to #6699FF(so that height change will be visible clearly)


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 Height 50
->Also change Button two Text property to Height 100
Your Design Window should look like this 
Label Height Changing Example














4.Double click on Button1(Height50 Button) to get the code behind->Write this code
5. Double click on Button2(Height100 Button) to get the code behind->Write this code
6.Click F5 to run your project.
Label Height Changing programmatically









Label Height Changing programmatically









No comments:

Post a Comment