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

Required Field Validator Does Not Block Postback

P: n/a
Wow, this is a really embarassing thing to have to ask about...

I have an asp.net page with a multiview control in it. We want to enter
person info in a semi - wizard style and I wanted to use required field
validators for, well required fields. On the first view, the person
enters first name, last name and a couple other things. the RFV works
great on first and last name and we move on to the next view -
Addresses. I want to be able to enter multiple addresses so I have an
update button that stores each address entered into a private variable
and clears the form for the next address (yes, it is set to
CauseValidation). The problem is the update button IS NOT causing
client side validation? WTF???

I thought this may be due to the views but I created a quick test
mockup with a MultiView, two views each with a button, a text field and
a RFV. It works every time.
Field and Validator:
<tr>
<th align="left" nowrap="nowrap">
Address One:
</th>
<td width="90%" align="left">
<asp:TextBox ID="txtAddressLineOne" runat="server"
MaxLength="100" Width="250px"></asp:TextBox>&nbsp;
<asp:RequiredFieldValidator id="rfvAddressLineOne"
runat="server" ErrorMessage="Address 1 is a
Required Field" ControlToValidate="txtAddressLineOne"
CssClass="ErrorMessage"
EnableClientScript="true">
*Required
</asp:RequiredFieldValidator>

</td>
</tr>
Button:

<asp:Button ID="btnUpdate" runat="server" Text="Update"
OnClick="btnUpdate_Click" CausesValidation="true"/>

Any ideas?

Dinsdale

Sep 22 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.