G
Guest
I have a web form with 3 links, depending on which link is clicked a user
control loads, page1.ascx,page2.ascx,page3.ascx
page1.ascx does a search, uses 3 asp:dropdownlists with viewstate true and
auto post back. It loads by default first time.
User clicks on link 2, page2.ascx loads after page1.ascx I need the loaded
control to go away when a different one is clicked, I have seen similar
stuff on threads but I can't understand a clear answer on what syntax and
where in the order?
I do not understand the syntax for controls.remove the sample says
control.remove where control.name =
and there is no controls.name in c sharp syntax for this? Also I am using
control array see below
private void OnPageButtonClick(object sender, System.EventArgs e)
{
LinkButton pageButton = (LinkButton)sender;
string pageNumber = pageButton.ID.Substring("_pageButton".Length);
ActiveTab = pageNumber;
SelectPage(pageNumber);
}
public void SelectPage(string pageNumber)
{
Control page = LoadControl(String.Format("Page{0}.ascx", pageNumber));
_content.Controls.Add(page);
LinkButton pageButton = FindControl(String.Format("_pageButton{0}",
pageNumber)) as LinkButton;
if (pageButton != null)
{
pageButton.BackColor = Color.Gold;
pageButton.CssClass = "tabon";
}
LastActiveControl = page.ID.ToString();
}
control loads, page1.ascx,page2.ascx,page3.ascx
page1.ascx does a search, uses 3 asp:dropdownlists with viewstate true and
auto post back. It loads by default first time.
User clicks on link 2, page2.ascx loads after page1.ascx I need the loaded
control to go away when a different one is clicked, I have seen similar
stuff on threads but I can't understand a clear answer on what syntax and
where in the order?
I do not understand the syntax for controls.remove the sample says
control.remove where control.name =
and there is no controls.name in c sharp syntax for this? Also I am using
control array see below
private void OnPageButtonClick(object sender, System.EventArgs e)
{
LinkButton pageButton = (LinkButton)sender;
string pageNumber = pageButton.ID.Substring("_pageButton".Length);
ActiveTab = pageNumber;
SelectPage(pageNumber);
}
public void SelectPage(string pageNumber)
{
Control page = LoadControl(String.Format("Page{0}.ascx", pageNumber));
_content.Controls.Add(page);
LinkButton pageButton = FindControl(String.Format("_pageButton{0}",
pageNumber)) as LinkButton;
if (pageButton != null)
{
pageButton.BackColor = Color.Gold;
pageButton.CssClass = "tabon";
}
LastActiveControl = page.ID.ToString();
}