protected void Page_Load(object sender, EventArgs e) { // Validate query params against hash value and check if control ID is not potential XSS threat string txtClientId = QueryHelper.GetString("txtelem", ""); string lblClientId = QueryHelper.GetString("lblelem", ""); Regex re = RegexHelper.GetRegex(@"[\w\d_$$]*"); if (!QueryHelper.ValidateHash("hash") || !re.IsMatch(txtClientId) || !re.IsMatch(lblClientId)) { pnlContent.Visible = false; btnOk.Visible = false; return; } if (!RequestHelper.IsPostBack()) { DataSet dsClasses = AlternativeFormInfoProvider.GetClassesWithAlternativeForms(); drpClass.DataSource = dsClasses; drpClass.DataValueField = "FormClassID"; drpClass.DataTextField = "ClassName"; drpClass.DataBind(); if (!DataHelper.DataSourceIsEmpty(dsClasses)) { // Try to preselect class from drop-down list string className = QueryHelper.GetString("classname", string.Empty); if (className != string.Empty) { drpClass.SelectedIndex = drpClass.Items.IndexOf(drpClass.Items.FindByText(className)); } else { drpClass.SelectedIndex = 0; } // Load alternative forms for selected class LoadAltFormsList(); } } btnOk.OnClientClick = "SelectCurrentAlternativeForm('" + txtClientId + "','" + lblClientId + "'); return false;"; btnCancel.OnClientClick = "Cancel(); return false;"; CurrentMaster.Title.TitleText = GetString("altforms.selectaltform"); CurrentMaster.Title.TitleImage = GetImageUrl("Design/Selectors/selectaltform.png"); ltlScript.Text = ScriptHelper.GetScript("var lstAlternativeForms = document.getElementById('" + lstAlternativeForms.ClientID + "');"); }