hello
i am working on web-form for which I have set the validation summary showmessagebox = "true".
I have two required field validators, which trigger on a checkbox's OnCheckedChange d event....now my problem is, when I hit submit, the page does not submit if I do not enter any values in the text boxes..which is correct behavior but it does not point out to the error or does not display the message box...i have to scroll up to see what is wrong with he page and then try to enter the values...I do not understand why my message box does not show up or at least why my setfocusonerror which is set to true does not show me the text boxes...
please find my code below...
thank you
i am working on web-form for which I have set the validation summary showmessagebox = "true".
I have two required field validators, which trigger on a checkbox's OnCheckedChange d event....now my problem is, when I hit submit, the page does not submit if I do not enter any values in the text boxes..which is correct behavior but it does not point out to the error or does not display the message box...i have to scroll up to see what is wrong with he page and then try to enter the values...I do not understand why my message box does not show up or at least why my setfocusonerror which is set to true does not show me the text boxes...
please find my code below...
Code:
<asp:CheckBox ID="wghtGPA" runat="server" AutoPostBack="true" OnCheckedChanged="wghtGPA_CheckedChanged" />
Code:
<asp:RequiredFieldValidator ID="rqrd_gpa" runat="server" ControlToValidate="gpa" Display="Dynamic" Enabled="false" ErrorMessage="Please enter the GPA" SetFocusOnError="true" ValidationGroup="Submit"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rqrd_classgpa" runat="server" Enabled="false" Display="Dynamic" ControlToValidate="classgpa" ErrorMessage="Please enter the GPA in the class" SetFocusOnError="true" ValidationGroup="Submit"></asp:RequiredFieldValidator
Code:
protected void weightedGPA_CheckedChanged(object sender, EventArgs e) { SetFocus(gpa); if (weightedGPA.Checked == true) { required_gpa.Enabled = true; // required_gpa.SetFocusOnError = true; required_classgpa.Enabled = true; // required_classgpa.SetFocusOnError = true; } else { required_gpa.Enabled = false; required_classgpa.Enabled = false; } SetFocus(gpa); }
Comment