Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX and required field validators

Status
Not open for further replies.

beaniebear

Programmer
Sep 14, 2001
93
0
0
GB
Hi,

I have an update panel with a text box and a button.

I have put a required field validator on the text box. When the button is clicked it is not doing the validation and posting the form even when there is nothing in the text box.

Any help would be much appreciated, thanks.
 
Make sure CausesValidation on the Button is NOT set to false:

Code:
<asp:Button ID="Button1" runat="server" Text="ValidateTextBox1" CausesValidation="true" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvTextBox1" runat="server" 
            ControlToValidate="TextBox1" Display="Static" ErrorMessage="Required">
</asp:RequiredFieldValidator>


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
I started the page again from scratch and it all worked the second time. I will remember this tip for future though. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top