Bunch's Blog

One day I'll have a catchy subtitle, one day
posts - 77, comments - 89, trackbacks - 0

My Links

News

Tag Cloud

Archives

Green

No Show on Second ValidatorCalloutExtender

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: http://weblogs.asp.net/sbehera/archive/2008/03/13/validatorcalloutextender-does-not-kick-flyout-after-first-submit-click.aspx

Technorati Tags: ,
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Wednesday, September 03, 2008 10:46 AM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: