protected void Page_Load(object sender, EventArgs e) { Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(), CountryDropDownList.ClientID); //testpath.Text = Request.PhysicalPath.Replace("AgentRegistration.aspx","Members"); if (!Page.IsPostBack) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the list of contries and populate. IList <CommonService.CountryInfo> countries = commonService.GetCountries(); CountryDropDownList.DataSource = countries; CountryDropDownList.DataValueField = "CountryId"; CountryDropDownList.DataTextField = "Name"; CountryDropDownList.DataBind(); CountryDropDownList.Items.FindByText("United States").Selected = true; CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs()); // Get the list of secret questions and populate. IList <CommonService.LookupInfo> secretQuestions = commonService.GetLookups("Secret Question"); SecretQuestionDropDownList.DataSource = secretQuestions; SecretQuestionDropDownList.DataValueField = "LookupId"; SecretQuestionDropDownList.DataTextField = "Name"; SecretQuestionDropDownList.DataBind(); // SecretQuestionDropDownList.Items.Add(new ListItem(" ","100")); SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);"); } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); ErrorLiteral.Text = "An unknown error occurred. Please try again. If the problem persists, please contact your system administrator."; } if (Session["registrationInfo"] != null) { InitializeValuesFromSession(); } } else { if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13")) { SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the list of secret questions and populate. IList <CommonService.LookupInfo> secretQuestions = commonService.GetLookups("Secret Question"); SecretQuestionDropDownList.DataSource = secretQuestions; SecretQuestionDropDownList.DataValueField = "LookupId"; SecretQuestionDropDownList.DataTextField = "Name"; SecretQuestionDropDownList.DataBind(); //SecretQuestionDropDownList.Items.Add(new ListItem(" ", "100")); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); registration = registrationService.GetDetails(loginInfo.UserId); ListItem questionItem = new ListItem(); questionItem = SecretQuestionDropDownList.Items.FindByText(registration.PasswordQuestion); if (questionItem == null) { //SecretQuestionDropDownList.SelectedValue = "13"; //SecretQuestionDropDownList.Items.FindByValue("13").Text = registration.PasswordQuestion; } else { //SecretQuestionDropDownList.SelectedValue = questionItem.Value; //SecretAnswerTextBox.Text = registration.PasswordAnswer; SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);"); } } else { if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13")) { SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value; } } }