Hi,
I am using tabstrip as a wizard.
I have previous and next buttons on my page and I load a user control in the multipage for each tabstrip.
When I navigate with the previous button. I have some binding controls on my pages which get bound when i pass the data for that particular tab.
WHen I am using the previous button it is trying to render all the tabs. SInce I don't pass data for all the tabs my code is not able to bind some controls.
Below is my code and html.
Let me know what am I doing wrong. I suspect I am not using the LoadStep() function call at the right place but I am not able to figure out the right event.
I am using tabstrip as a wizard.
I have previous and next buttons on my page and I load a user control in the multipage for each tabstrip.
When I navigate with the previous button. I have some binding controls on my pages which get bound when i pass the data for that particular tab.
WHen I am using the previous button it is trying to render all the tabs. SInce I don't pass data for all the tabs my code is not able to bind some controls.
Below is my code and html.
Let me know what am I doing wrong. I suspect I am not using the LoadStep() function call at the right place but I am not able to figure out the right event.
<
table
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"100%"
>
<
tr
>
<
td
>
<
telerik:RadTabStrip
ID
=
"rtsEnrollment"
runat
=
"server"
MultiPageID
=
"rmpEnrollment"
OnTabClick
=
"rtsEnrollment_TabClick"
SelectedIndex
=
"0"
CausesValidation
=
"true"
Align
=
"Justify"
AutoPostBack
=
"true"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"rmpEnrollment"
runat
=
"server"
SelectedIndex
=
"0"
OnPageViewCreated
=
"rmpEnrollment_PageViewCreated"
CssClass
=
"multiPage"
>
</
telerik:RadMultiPage
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"enrollmentButton"
>
<
telerik:RadButton
runat
=
"server"
ID
=
"PreviousButton"
Text
=
"<< Previous"
OnClick
=
"PreviousButton_Click"
AutoPostBack
=
"true"
CausesValidation
=
"false"
>
</
telerik:RadButton
>
<
telerik:RadButton
runat
=
"server"
ID
=
"ContinueButton"
Text="Next >>" CausesValidation="true"
AutoPostBack="true" OnClick="ContinueButton_Click">
</
telerik:RadButton
>
</
td
>
</
tr
>
</
table
>
public partial class enrollment_theCompany_EDCP : EnrollmentBasePage
{
protected void LoadStep()
{
string tabName = rtsEnrollment.SelectedTab.Text;
RadTab tab = rtsEnrollment.FindTabByText(tabName);
switch (rtsEnrollment.SelectedTab.Text)
{
case "Deferral Elections":
LoadSalaryElections(tab);
break;
case "Distribution Elections":
LoadDistributionElections(tab);
break;
case "Fund Allocations":
RadPageView pvFundAllocations = (RadPageView)tab.PageView.FindControl("fundAllocations");
ucFundBucket ucFundAllocations = (ucFundBucket)pvFundAllocations.FindControl("ucFundAllocations");
ucFundAllocations.LoadPlan();
break;
case "Enrollment Summary":
// commit data
RadPageView pvEnrollmentSummary = (RadPageView)tab.PageView.FindControl("enrollmentSummary");
enrollment_ucEnrollmentSummary ucEnrollmentSummary = (enrollment_ucEnrollmentSummary)pvEnrollmentSummary.FindControl("ucEnrollmentSummary");
_enrollment.CommitEnrollmentData(DeferralSources());
break;
}
}
protected override void UpdateStep(int nextStepIndex)
{
string tabName = rtsEnrollment.SelectedTab.Text;
RadTab tab = rtsEnrollment.FindTabByText(tabName);
switch (tabName)
{
case "Deferral Elections":
RadPageView pvDeferralElections = (RadPageView)tab.PageView.FindControl("deferralElections");
enrollment_theCompany_deferralElections ucDeferralElections = (enrollment_theCompany_deferralElections)pvDeferralElections.FindControl("ucDeferralElections");
ucDeferralElections.SaveForEnrollment(_enrollment);
break;
case "Distribution Elections":
RadPageView pvPaymentOptions = (RadPageView)tab.PageView.FindControl("paymentOptions");
enrollment_theCompany_paymentOptions ucPaymentOptions = (enrollment_theCompany_paymentOptions)pvPaymentOptions.FindControl("ucPaymentOptions");
ucPaymentOptions.PlanPeriodName = _enrollment.PlanPeriodName;
ucPaymentOptions.SaveForEnrollment(_enrollment);
break;
case "Fund Allocations":
RadPageView pvFundAllocations = (RadPageView)tab.PageView.FindControl("fundAllocations");
ucFundBucket ucFundAllocations = (ucFundBucket)pvFundAllocations.FindControl("ucFundAllocations");
ucFundAllocations.SaveAllocationForEnrollment(_enrollment);
break;
case "Enrollment Summary":
break;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
AddTab("Deferral Elections", true);
RadPageView pageView = new RadPageView();
pageView.ID = "DeferralElections";
rmpEnrollment.PageViews.Add(pageView);
AddTab("Distribution Elections", false);
AddTab("Fund Allocations", false);
AddTab("Enrollment Summary", false);
LoadStep();
}
}
#region UI Events
protected void rmpEnrollment_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
Control pageViewContents = new Control();
switch (e.PageView.ID)
{
case "DeferralElections":
pageViewContents = LoadControl("~/enrollment/thecompany/deferralElections.ascx");
pageViewContents.ID = "uc" + e.PageView.ID ;
break;
case "PaymentOptions":
pageViewContents = LoadControl("~/enrollment/thecompany/paymentOptions.ascx");
pageViewContents.ID = "uc" + e.PageView.ID;
break;
case "FundAllocations":
pageViewContents = LoadControl("~/fund/ucFundbucket.ascx");
pageViewContents.ID = "uc" + e.PageView.ID;
break;
case "EnrollmentSummary":
pageViewContents = LoadControl("~/enrollment/ucEnrollmentSummary.ascx");
pageViewContents.ID = "uc" + e.PageView.ID;
break;
}
e.PageView.Controls.Add(pageViewContents);
}
protected void PreviousButton_Click(object sender, EventArgs e)
{
GoToPreviousTab();
GoToPreviousPageView();
LoadStep();
}
protected void ContinueButton_Click(object sender, EventArgs e)
{
UpdateStep();
GoToNextTab();
GoToNextPageView();
LoadStep();
}
#endregion
#region Private Events
private void GoToNextTab()
{
string tabName = rtsEnrollment.SelectedTab.Text;
switch (tabName)
{
case "Deferral Elections":
RadTab paymentOptionsTab = rtsEnrollment.FindTabByText("Distribution Elections");
rtsEnrollment.ValidationGroup = "PaymentOptionsTabValidationGroup";
paymentOptionsTab.Enabled = true;
paymentOptionsTab.Selected = true;
break;
case "Distribution Elections":
RadTab fundAllocationsTab = rtsEnrollment.FindTabByText("Fund Allocations");
fundAllocationsTab.Enabled = true;
fundAllocationsTab.Selected = true;
break;
case "Fund Allocations":
RadTab enrollmentSummaryTab = rtsEnrollment.FindTabByText("Enrollment Summary");
enrollmentSummaryTab.Enabled = true;
enrollmentSummaryTab.Selected = true;
break;
case "Enrollment Summary":
break;
}
}
private void GoToNextPageView()
{
string tabName = rtsEnrollment.SelectedTab.Text;
switch (tabName)
{
case "Deferral Elections":
break;
case "Distribution Elections":
RadPageView paymentOptionsTabPageView = rmpEnrollment.FindPageViewByID("PaymentOptions");
if (paymentOptionsTabPageView == null)
{
paymentOptionsTabPageView = new RadPageView();
paymentOptionsTabPageView.ID = "PaymentOptions";
rmpEnrollment.PageViews.Add(paymentOptionsTabPageView);
}
paymentOptionsTabPageView.Selected = true;
break;
case "Fund Allocations":
RadPageView fundAllocationsTabPageView = rmpEnrollment.FindPageViewByID("FundAllocations");
if (fundAllocationsTabPageView == null)
{
fundAllocationsTabPageView = new RadPageView();
fundAllocationsTabPageView.ID = "FundAllocations";
rmpEnrollment.PageViews.Add(fundAllocationsTabPageView);
}
fundAllocationsTabPageView.Selected = true;
break;
case "Enrollment Summary":
RadPageView enrollmentSummaryTabPageView = rmpEnrollment.FindPageViewByID("EnrollmentSummary");
if (enrollmentSummaryTabPageView == null)
{
enrollmentSummaryTabPageView = new RadPageView();
enrollmentSummaryTabPageView.ID = "EnrollmentSummary";
rmpEnrollment.PageViews.Add(enrollmentSummaryTabPageView);
}
enrollmentSummaryTabPageView.Selected = true;
break;
}
}
private void GoToPreviousTab()
{
string tabName = rtsEnrollment.SelectedTab.Text;
switch (tabName)
{
case "Deferral Elections":
break;
case "Distribution Elections":
RadTab deferralElectionsTab = rtsEnrollment.FindTabByText("Deferral Elections");
rtsEnrollment.ValidationGroup = "DeferralElectionsTabValidationGroup";
deferralElectionsTab.Enabled = true;
deferralElectionsTab.Selected = true;
break;
case "Fund Allocations":
RadTab paymentOptionsTab = rtsEnrollment.FindTabByText("Distribution Elections");
rtsEnrollment.ValidationGroup = "PaymentOptionsTabValidationGroup";
paymentOptionsTab.Enabled = true;
paymentOptionsTab.Selected = true;
break;
case "Enrollment Summary":
RadTab FundAllocationsTab = rtsEnrollment.FindTabByText("Fund Allocations");
FundAllocationsTab.Enabled = true;
FundAllocationsTab.Selected = true;
break;
}
}
private void GoToPreviousPageView()
{
string tabName = rtsEnrollment.SelectedTab.Text;
switch (tabName)
{
case "Deferral Elections":
RadPageView deferralElectionsTabPageView = rmpEnrollment.FindPageViewByID("DeferralElections");
if (deferralElectionsTabPageView == null)
{
deferralElectionsTabPageView = new RadPageView();
deferralElectionsTabPageView.ID = "DeferralElections";
rmpEnrollment.PageViews.Add(deferralElectionsTabPageView);
}
deferralElectionsTabPageView.Selected = true;
break;
case "Distribution Elections":
RadPageView paymentOptionsTabPageView = rmpEnrollment.FindPageViewByID("PaymentOptions");
if (paymentOptionsTabPageView == null)
{
paymentOptionsTabPageView = new RadPageView();
paymentOptionsTabPageView.ID = "PaymentOptions";
rmpEnrollment.PageViews.Add(paymentOptionsTabPageView);
}
paymentOptionsTabPageView.Selected = true;
break;
case "Fund Allocations":
RadPageView fundAllocationsTabPageView = rmpEnrollment.FindPageViewByID("FundAllocations");
if (fundAllocationsTabPageView == null)
{
fundAllocationsTabPageView = new RadPageView();
fundAllocationsTabPageView.ID = "FundAllocations";
rmpEnrollment.PageViews.Add(fundAllocationsTabPageView);
}
fundAllocationsTabPageView.Selected = true;
break;
case "Enrollment Summary":
break;
}
}
private void AddTab(string tabName, bool enabled)
{
RadTab tab = new RadTab(tabName);
tab.Enabled = enabled;
switch (tab.Text)
{
case "Deferral Elections":
break;
case "Distribution Elections":
break;
case "Fund Allocations":
break;
case "Enrollment Summary":
//tab.ImageUrl = "Images/4_normal.png";
//tab.SelectedImageUrl = "Images/4_active.png";
//tab.DisabledImageUrl = "Images/4_disable.png";
break;
default:
break;
}
rtsEnrollment.Tabs.Add(tab);
}
private void LoadSalaryElections(RadTab tab)
{
RadPageView pvDeferralElections = (RadPageView)tab.PageView.FindControl("deferralElections");
enrollment_theCompany_deferralElections ucDeferralElections = (enrollment_theCompany_deferralElections)pvDeferralElections.FindControl("ucDeferralElections");
ucDeferralElections.PlanPeriodName = _enrollment.PlanPeriodName;
ucDeferralElections.NextPlanPeriodName = _enrollment.NextPlanPeriodName;
ucDeferralElections.LoadDeferralElections(_enrollment);
}
private void LoadDistributionElections(RadTab tab)
{
RadPageView pvPaymentOptions = (RadPageView)tab.PageView.FindControl("paymentOptions");
enrollment_theCompany_paymentOptions ucPaymentOptions = (enrollment_theCompany_paymentOptions)pvPaymentOptions.FindControl("ucPaymentOptions");
ucPaymentOptions.LoadPaymentOptions(_enrollment);
}
#endregion
}