protected void btnAdd_Click(object sender, EventArgs e) { lblErrorMessage.Visible = false; ArrayList arrForStoringDates; DropDownList ddlTotalLeauges = (DropDownList)CreateUserWizardStep1.FindControl("ddlTotalLeagues"); string val = ddlTotalLeagues.SelectedValue; if (ViewState["arr"] == null) { arrForStoringDates = new ArrayList(); } else { arrForStoringDates = (ArrayList)ViewState["arr"]; } bool check = false; for (int i = 0; i < arrForStoringDates.Count; i = i + 3) { if ((string)arrForStoringDates[i] == val) { check = true; lblErrorMessage.Text = "You have already selected this League"; lblErrorMessage.ForeColor = System.Drawing.Color.Red; lblErrorMessage.Visible = true; break; } else { lblErrorMessage.Visible = false; } } Calendar startDate = (Calendar)CreateUserWizardStep1.FindControl("calStartDate"); DateTime startSelectedDate = startDate.SelectedDate; Calendar endDate = (Calendar)CreateUserWizardStep1.FindControl("calEndDate"); DateTime endSelectedDate = endDate.SelectedDate; if (check == false) { arrForStoringDates.Add(val); arrForStoringDates.Add(startSelectedDate); arrForStoringDates.Add(endSelectedDate); lblErrorMessage.Visible = true; lblErrorMessage.Text = "Start and End Date Added!"; lblErrorMessage.ForeColor = System.Drawing.Color.Green; //Session["arr"] = arrForStoringDates; ViewState["arr"] = arrForStoringDates; } }
protected void CreateUserWizard1_NextButtonClick(object sender, WizardNavigationEventArgs e) { double orgFee = 34.99; double leagueFee = 24.99; double discontedLeagueFee = 19.99; WizardStepBase a = CreateUserWizard1.ActiveStep; if (a.ID == "CreateUserWizardStep0") { TextBox totalLeagues = (TextBox)CreateUserWizardStep0.FindControl("txt_league"); int totalLeaguesToFillInDropDown = Convert.ToInt32(totalLeagues.Text); DropDownList ddlTotalLeagues = (DropDownList)CreateUserWizardStep1.FindControl("ddlTotalLeagues"); for (int i = 1; i <= totalLeaguesToFillInDropDown; i++) { ddlTotalLeagues.Items.Add(i.ToString()); } // Button aa = (Button)CreateUserWizardStep0.FindControl("StepNavigationTemplate").FindControl("StepNextButton"); // Money Logic here double amount = 0; int noOfLeaguesForAmountCalculation = Convert.ToInt32(txt_league.Text); if (noOfLeaguesForAmountCalculation <= 5) { amount = orgFee + (noOfLeaguesForAmountCalculation * leagueFee); } else { amount = orgFee + (noOfLeaguesForAmountCalculation * discontedLeagueFee); } AmountTextBox.Text = amount.ToString(); } else if (a.ID == "CreateUserWizardStep1") { //if (Session["arr"]==null) if (ViewState["arr"] == null) { e.Cancel = true; } else { ArrayList arrCount = (ArrayList)ViewState["arr"]; if (arrCount.Count < (ddlTotalLeagues.Items.Count * 3)) { lblErrorMessage.Text = "Select Start and End Date for All Leagues"; lblErrorMessage.ForeColor = System.Drawing.Color.Red; lblErrorMessage.Visible = true; e.Cancel = true; } else { lblErrorMessage.Visible = false; } } } else if (a.ID == "CreateUserWizardStep2") { if (e.Cancel == true) { //string testingg = CustomValidator1.ErrorMessage; e.Cancel = false; CreateUserWizard1.ActiveStepIndex = 2; //CustomValidator1.Visible = true; //ServerValidateEventArgs srve = new ServerValidateEventArgs(testingg, true); //CustomValidator1_ServerValidate(null, srve); //CustomValidator1.ErrorMessage = testingg; //lblError.Text = testingg; } //string abc = (string)Session["creditCard"]; //if (Session["creditCard"] != "1") ////if (Session["creditCard"] ) //{ // lblError.Text = "Kindly, Submit the credit card information first."; // lblError.ForeColor = System.Drawing.Color.Red; // lblError.Visible = true; // e.Cancel = true; //} //else //{ // lblError.Visible = false; //} } else if (a.ID == "CreateUserWizardStep3") { } }