By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

RequiredFieldValidator disable on new page load

P: n/a
I'm using VS2005. I have a form that has fields and a required field
validator control on it. Everything works great except there's a
behavior I'm trying to get working. If a user is on a form and are in
the middle of editing it, they can click other links on the page that
would take them elsewhere and out of the form edit. Problem is that
the validator fires off that required fields are not completed and
prevents the new page from being loaded. Any idea how I can turn this
validator off when it detects that a new page is being loaded?

Feb 25 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Set the CausesValidation property of the Button, ImageButton, or LinkButton.
If the Control they are clicking is not one of these Control types, let us
know what type it is so we can help more. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bdtmike" <mi******@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I'm using VS2005. I have a form that has fields and a required field
validator control on it. Everything works great except there's a
behavior I'm trying to get working. If a user is on a form and are in
the middle of editing it, they can click other links on the page that
would take them elsewhere and out of the form edit. Problem is that
the validator fires off that required fields are not completed and
prevents the new page from being loaded. Any idea how I can turn this
validator off when it detects that a new page is being loaded?

Feb 25 '06 #2

P: n/a
It's a plain old hyperlink that takes them to another page

Feb 25 '06 #3

P: n/a
Hi Mike,

I'm not sure I understand your problem, but is it that the user can't
navigate away because of the validation? If so, set causesvalidation="False"
for any control that allows the user to leave. I've pasted in a small sample
below.

If I missed your real issue, let us know?

Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("http://www.kencox.ca")
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator1"
runat="server" controltovalidate="TextBox1"
errormessage="Required!"></asp:requiredfieldvalidator><br />
<br />
<asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Button" />
<br />
<br />
<asp:linkbutton id="LinkButton1" runat="server"
causesvalidation="False"
onclick="LinkButton1_Click">LinkButton</asp:linkbutton>

</div>
</form>
</body>
</html>

"bdtmike" <mi******@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I'm using VS2005. I have a form that has fields and a required field
validator control on it. Everything works great except there's a
behavior I'm trying to get working. If a user is on a form and are in
the middle of editing it, they can click other links on the page that
would take them elsewhere and out of the form edit. Problem is that
the validator fires off that required fields are not completed and
prevents the new page from being loaded. Any idea how I can turn this
validator off when it detects that a new page is being loaded?

Feb 26 '06 #4

P: n/a
Do you, anywhere in your code, call the Validate() method (of either the
Page object or a specific Validator)? I think it might help us if we could
see all your code, sometimes it can be hard to find the problem when we have
to try to think of every possible scenario. (NOTE: It is a good idea to
include the previous messages in your replies so that people responding can
see what you have already tried, what others have suggested, etc. without
needing to open every message).
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bdtmike" <mi******@gmail.com> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
It's a plain old hyperlink that takes them to another page

Feb 26 '06 #5

P: n/a
Well, the "causes validation" isn't an option when the user clicks on a
hyperlink on the page. This is a regular old hyperlink and there's no
property to set for this that would turn off validation.

Feb 28 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.