This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Sunday, November 2, 2008

asp.net code to 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


CODE:
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

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger