Please help .... Loop through content page controls

P

pargat.singh

Hi :

I am using Master/Child page in VS2005 and i wrote generic function
to show/hide controls which works fine if i don't use master/child
[menas it work fine in single page].Below is my function which work
fine for single page to show/hide controls.

private void displayOrHideControls(string ctrlNames, string Mode)
{
string[] arControlNames = ctrlNames.Split(new char[] { ';' });
for (int i = 0; i < arControlNames.Length; i++)
{

string name = arControlNames.ToString();
foreach (Control ctrl in Page.Controls)
{
if (ctrl.HasControls())
{
foreach (Control ctrl2 in ctrl.Controls)
{
if (ctrl2.ID == name)
{
if (Mode == "SHOW")
{
ctrl2.Visible = true;
}
else if (Mode == "HIDE")
{
ctrl2.Visible = false;
}
}
}
}
}
}
}

Can anyone please tell me how can i loop through content page controls?

Thanks,
Pargat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top