How to Show or Hide Panel Control Programmatically in asp.net using c#

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. Click ToolBox-> Double Click on Panel(or drag and drop Panel on Design view)->You can increase your Panel Width and height by clicking the sign(shown on arrow)->Right click on Panel->Select Properties->Change BorderStyle property to Solid(this is your panel border style)
Your Design Window should look like this















ToolBox->Double click on Button->Right click on Button->select properties->Change Text properties to "Show Panel" (Place your Buttons Outside Panel)

ToolBox->Double click on Button->Right click on Button->select properties->Change Text properties to "Hide Panel"

3. Double Click on Button1(Show Panel Button)->Write this code
4.Double Click on Button2(Hide Panel Button)->Write this code
5.Click F5 to run your project->OK
















Panel Control is Hidden now

Panel Control is Shown When the Show Panel Button Clicked








No comments:

Post a Comment