1 Replies - 977 Views - Last Post: 28 July 2008 - 08:14 AM Rate Topic: -----

#1 net nerd865  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 52
  • Joined: 16-June 08

Limit validation to section of page

Posted 28 July 2008 - 07:50 AM

I'm working on this little quiz web application where basically I have 10 questions and a submit button. Now I want it to make sure all questions have an answer before it is submitted, but once I am on this page, all questions have to be answered before I can leave.

I have a tabbed menu and because I have a RequiredFieldValidator attached to my quiz questions, they have to be answered before leaving the page. Is there a way to limit validation to, say, the Panel containing the quiz so that I can still navigate away?

Here's a sample of my quiz thing. When the button is hit, the panel will swap with the answers panel. But to even navigate away from the page with other links that aren't the button, it requires validation. Is there a better Validate control for this?
<asp:Panel id="Panel1" width="600" runat="server">
	<h3>
		<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadioButtonList1"
			ErrorMessage="*  "></asp:RequiredFieldValidator>Question 1h3>
	<asp:RadioButtonList ID="RadioButtonList1" runat="server">
		<asp:ListItem>Ans 1</asp:ListItem>
		<asp:ListItem>Ans 2</asp:ListItem>
		<asp:ListItem>Ans 3</asp:ListItem>
		<asp:ListItem>Ans 4</asp:ListItem>
	</asp:RadioButtonList>
	<h3>
		<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="RadioButtonList2"
			ErrorMessage="*  "></asp:RequiredFieldValidator>Question 2</h3>
	<asp:RadioButtonList ID="RadioButtonList2" runat="server">
			<asp:ListItem>Ans 1</asp:ListItem>
			<asp:ListItem>Ans 2</asp:ListItem>
			<asp:ListItem>Ans 3</asp:ListItem>
			<asp:ListItem>Ans 4</asp:ListItem>
	</asp:RadioButtonList>

	<asp:Button onclick="checkAns" ID="Button1" runat="server" Text="Grade It" />
</asp:Panel>



Is This A Good Question/Topic? 0
  • +

Replies To: Limit validation to section of page

#2 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: Limit validation to section of page

Posted 28 July 2008 - 08:14 AM

Try setting CausesValidation='false' on anything that you want to have work without validation.

Alternately, look into the ValidationGroup property.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1