Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources

Hide and Unhide controls

The usual way we do it it

controlname.Visible = false;

controlname.Visible = true;

This is really cumbersome if we have a lot of controls to be made visible and unvisible

So to solve this we create a method that does just that


public static void HideControls(params System.Web.UI.Control[] controlsToHide)

{

try

{

foreach(System.Web.UI.Control control in controlsToHide)

{

control.Visible = false;

}

}

catch

{

}

}









//// Function to show controls



public static void ShowControls(params System.Web.UI.Control[] controlsToShow)

{

try

{

foreach(System.Web.UI.Control control in controlsToShow)

{

control.Visible = true;

}

}

catch

{

}

}







Just call the respecitve functions to hide and unhide

HideControls(controlname1,controlname2);
UF.ShowControls(controlname1

Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy

Website Design & Internet Marketing by Shivam