Show particular panel(s) July 30, 2008
Posted by aminz in Uncategorized.Tags: asp.net
trackback
I need a normal function which show a particular panel or panels and hide al other. I have ceated a simple way of showing the panel, I am using C#
private void HidePanels(String[] currentPanels)
{
ArrayList arr = new ArrayList();
ControlCollection cons = UPUsers.Controls[0].Controls;
// UPUsers is <asp:UpdatePanel> control
foreach (Control c in cons)
{
if (c.GetType().FullName.Equals(“System.Web.UI.WebControls.Panel”))
arr.Add(c.ClientID);
}
for (int i = 0; i < arr.Count; i++)
{
System.Web.UI.WebControls.Panel pnl = (System.Web.UI.WebControls.Panel)UPUsers.FindControl(arr[i].ToString());
pnl.Visible = false;
}
for (int j = 0; j < currentPanels.Length; j++)
{
System.Web.UI.WebControls.Panel pnl = (System.Web.UI.WebControls.Panel)UPUsers.FindControl(currentPanels[j].ToString());
pnl.Visible = true;
}
}
and a overloaded function is
private void HidePanels(String currentPanel)
{
ArrayList arr = new ArrayList();
ControlCollection cons = UPUsers.Controls[0].Controls;
foreach (Control c in cons){
if (c.GetType().FullName.Equals(“System.Web.UI.WebControls.Panel”))
arr.Add(c.ClientID);
}
for(int i = 0;i<arr.Count;i++)
{
System.Web.UI.WebControls.Panel pnl = (System.Web.UI.WebControls.Panel)UPUsers.FindControl(arr[i].ToString());
if (pnl.ID.Equals(currentPanel)){
pnl.Visible = true;}
else{
pnl.Visible = false;}
}
}




Comments»
No comments yet — be the first.