Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day

I was working on an application recently that was pretty typical data entry stuff. Nothing fancy but I did want to try out the AJAX ValidatorCalloutExtenders.

I had them all setup using the ValidatorCalloutExtenders to well extend my RequiredFieldValidators. They were then tied to a button to save the data back to the database. All told there were seven different required fields for this form.


<asp:Button ID="btnInsert" runat="server" CommandName="insert" Text="Add New" Visible="true" CausesValidation="true" ValidationGroup="vgAddNew"/>


<asp:TextBox ID="txtAddr1" runat="server" Width="300px" Text='<%# BIND("Address") %>'></asp:TextBox>

<asp:RequiredFieldValidator ID="rfvAddr1" runat="server" ControlToValidate="txtAddr1" ErrorMessage="Address is required" Display="None" ValidationGroup="vgAddNew" />

<cc1:ValidatorCalloutExtender ID="vceAddr1" runat="server" TargetControlID="rfvAddr1" />


The issue I ran into was that the flyout would only show on the first field I missed. So if I did not fill in two required fields the first would get the flyout showing what was required. Once I filled that it and tried to submit the form the other flyout would never show. The form did not get submitted but you did not know what happened.


The fix was fairly simple. I added SetFocusOnError="true" to all the RequiredFieldValidator controls. After that if I missed two fields on the form the first flyout would display and if I missed a second it would display after I clicked the submit button.


More info can be found here and where I found the solution:

Technorati Tags: ,
Posted on Wednesday, September 3, 2008 10:46 AM ASP.Net , Ajax | Back to top

Comments on this post: No Show on Second ValidatorCalloutExtender

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Bunch | Powered by: