protected void AllCustomValidator_ServerValidate(object source, ServerValidateEventArgs args) { var result = User.ValidateMemberRegistration( FirstNameTextBox.Text, LastNameTextBox.Text, EmailTextBox.Text, UserName.Text, PasswordTextBox.Text, string.Format("{0}-{1}-{2}", YearDropDownList.SelectedValue, MonthDropDownList.SelectedValue, DayDropDownList.SelectedValue), GenderDropDownList.SelectedValue, TermsCheckBox.Checked, NewsCheckBox.Checked ); var errors = result.Where(x => !string.IsNullOrEmpty(x.Message)).Select(x => x.Message); var valid = errors.Count() == 0; args.IsValid = valid; HelperFunctions.FindControl <Label>(this, "ErrorLabel").Text = valid ? "" : string.Join("<br />\r\n", errors); HelperFunctions.FindControl <Panel>(this, "ErrorPanel").Style.Add("display", valid ? "none" : "block"); }
protected void AllCustomValidator_ServerValidate(object source, ServerValidateEventArgs args) { var result = User.ValidateMemberRegistration( FirstNameTextBox.Text, LastNameTextBox.Text, EmailTextBox.Text, UserName.Text, PasswordTextBox.Text, string.Format("{0}-{1}-{2}", YearDropDownList.SelectedValue, MonthDropDownList.SelectedValue, DayDropDownList.SelectedValue), GenderDropDownList.SelectedValue, TermsCheckBox.Checked, NewsCheckBox.Checked, SecurityContext.Current.RequiredFields ); var errors = result.Where(x => !string.IsNullOrEmpty(x.Message)).Select(x => x.Message); var valid = errors.Count() == 0; args.IsValid = valid; HelperFunctions.FindControl <Label>(this, "ErrorLabel").Text = valid ? "" : string.Join("<br />\r\n", errors); HelperFunctions.FindControl <Panel>(this, "ErrorPanel").Style["display"] = valid ? "none" : "block"; var values = (UserFieldName[])Enum.GetValues(typeof(UserFieldName)); foreach (var item in values) { var id = string.Format("{0}Status", item); var div = HelperFunctions.FindControl <HtmlGenericControl>(this, id); if (div != null) { if (result.Any(x => x.Name == item)) { div.Attributes["class"] = "SWUI_Table_Result0Changed"; } else { if (SecurityContext.Current.RequiredFields.HasFlag(item)) { div.Attributes["class"] = "SWUI_Table_Result1"; } else { div.Attributes["class"] = ""; } } } } }