Okay, Here is the web page page load method:
private void Page_Load(object sender, System.EventArgs e)
{
myReq = (SupportRequest)Session["request"];
if (myReq.options.Count > 0 && myReq.optionIndex <
myReq.options.Count)
{
opt = (Option)myReq.options[myReq.optionIndex];
opt.LoadPanel(this);
}
}
Here is Option's LoadPanel method:
public void LoadPanel(System.Web.UI.Page page)
{
// Load user control
userControl = (UserControl)page.LoadControl ("Controls\\UserControl" +
this.type + ".ascx");
PlaceHolder plh = (PlaceHolder)page.FindControl("plhControls");
plh.Controls.Add(userControl);
}
Here is Option's Next button action:
private void btnNext_Click(object sender, System.EventArgs e)
{
myReq = (SupportRequest)Session["request"];
Option opt = (Option)myReq.options[myReq.optionIndex];
// Save current page and turn it off
System.Web.UI.Page page = this.Page;
opt.SavePanel(page); // this removes the usercontrol from a
placeholder on the page using plh.Controls.RemoveAt(0)
opt.Save();
myReq.optionIndex++;
if (myReq.optionIndex < myReq.options.Count)
{
opt = (Option)myReq.options[myReq.optionIndex];
opt.LoadPanel(page);
}
}
Here is a Back button action:
private void btnSumBack_Click(object sender, System.EventArgs e)
{
SupportRequest myReq = (SupportRequest)Session["request"];
System.Web.UI.Page page = this.Page;
PlaceHolder plh = (PlaceHolder)page.FindControl("plhControls");
plh.Controls.RemoveAt(0);
myReq.optionIndex--;
if (myReq.options.Count > 0)
{
opt = (Option)myReq.options[myReq.optionIndex];
opt.LoadPanel(page);
}
}
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!