Solved

Multiple RegularExpressionValidator and ValidatorCalloutExtender

Posted on 2008-10-14
1
1,307 Views
Last Modified: 2012-05-05
So i have a page where the user selects a name from a drop down and this populates a text box with the users email address , there are also values that are free form to where the user can enter in there own email address. So to help with validation i put a regular expresssion validator and a call out extender to let the user know if they typed in the email address  incorrectly. So this works fine and if the user clicks submit it correctly pops up a message over the incorrect text box. So if there are more than one text box with an issue can i have multple extenders show? what also seems to happen is that only the first text shows up as an error when i click submit so i fix that one, any subsequent boxes will not display an error but the page will not submit.

here is what i have for aspx code
<table>
                    <tr>
                        <td><asp:Label runat="server" ID="lblContactType" >Contact Type</asp:Label></td>
                        <td><asp:Label runat="server" ID="lblName" >Name</asp:Label></td>
                        <td><asp:Label runat="server" ID="Label30" >E-mail Address</asp:Label>
                       
                        </td>
                    </tr>
                    <tr>
                        <td><asp:Label runat="server" ID="Label31" >Business Driver:</asp:Label></td>
                        <td><sb:DropDownList runat="server" ID="BusinessDriver"  Enabled="false" >
                        </sb:DropDownList></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbBusinessDriverEmail" Width="350px" MaxLength="50" Enabled="false"></sb:TextBox>
                            <asp:RegularExpressionValidator ID="rvBusinessEmail" runat="server"  ControlToValidate="sbBusinessDriverEmail"  EnableClientScript="true" SetFocusOnError="true"  
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="veBusinessEmail" TargetControlID="rvBusinessEmail"  Width="250px"  
                            HighlightCssClass="highlight" />
                           
                            </td>
                    </tr>
                    <tr>
                        <td><asp:Label runat="server" ID="Label32" >Impact Analysis:</asp:Label></td>
                        <td><sb:DropDownList runat="server" ID="ImpactAnalysis" Enabled="false"></sb:DropDownList></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbImpactAnalysisEmail" Width="350px"  MaxLength="50" Enabled="false"></sb:TextBox>
                         <asp:RegularExpressionValidator ID="REAnalysisEmail" runat="server"  ControlToValidate="sbImpactAnalysisEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VEImpactEmail" TargetControlID="REAnalysisEmail" Width="250px"
                            HighlightCssClass="highlight" />    
                        </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label33" >BSC:</asp:Label></td>
                        <td><sb:DropDownList runat="server" ID="BSC" Enabled="false"></sb:DropDownList></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbBSCEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                             <asp:RegularExpressionValidator ID="REBSC" runat="server"  ControlToValidate="sbBSCEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VEBSC" TargetControlID="REBSC" Width="250px"
                            HighlightCssClass="highlight" />
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label34" >UAT Analyst:</asp:Label></td>
                        <td><sb:DropDownList runat="server" ID="UATAnalyst" Enabled="false"></sb:DropDownList></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbUATAnalystEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                             <asp:RegularExpressionValidator ID="REUAT" runat="server"  ControlToValidate="sbUATAnalystEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VEUAT" TargetControlID="REUAT" Width="250px"
                            HighlightCssClass="highlight" />
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label36" >CSSO PM:</asp:Label></td>
                        <td><sb:DropDownList runat="server" ID="CSSOPM" Enabled="false"></sb:DropDownList></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbCSSOPMEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                          <asp:RegularExpressionValidator ID="RECSSO" runat="server"  ControlToValidate="sbCSSOPMEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VECSSO" TargetControlID="RECSSO" Width="250px"
                            HighlightCssClass="highlight" />  
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label39" >TIG PM:</asp:Label></td>
                        <td><sb:TextBox runat="server" ID ="sbTIGPMName" Enabled="false"></sb:TextBox></td>
                        <td>
                        <sb:TextBox runat="server" ID ="sbTIGPMNEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                         <asp:RegularExpressionValidator ID="RETIGPM" runat="server"  ControlToValidate="sbTIGPMNEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VETIGPM" TargetControlID="RETIGPM" Width="250px"
                            HighlightCssClass="highlight" />
                        </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label40" >PI&C:</asp:Label></td>
                        <td><sb:TextBox runat="server" ID ="sbPLCName" Enabled="false"></sb:TextBox></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbPLCEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                             <asp:RegularExpressionValidator ID="REPLC" runat="server"  ControlToValidate="sbPLCEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VEPLC" TargetControlID="REPLC" Width="250px"
                            HighlightCssClass="highlight" />
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label41" >L&D:</asp:Label></td>
                        <td><sb:TextBox runat="server" ID ="sbLDName" Enabled="false"></sb:TextBox></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbLDEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                             <asp:RegularExpressionValidator ID="rvLDEmail" runat="server"  ControlToValidate="sbLDEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender
                            runat="Server"
                            ID="ValidatorCalloutExtender8"
                            TargetControlID="rvLDEmail"
                            Width="250px"
                            HighlightCssClass="highlight"
                            />
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label42" >Sales Team Lead: </asp:Label></td>
                        <td><sb:TextBox runat="server" ID ="sbSalesTeamLeadName" Enabled="false"></sb:TextBox></td>
                        <td>
                            <sb:TextBox runat="server" ID ="sbSalesTeamLeadEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                             <asp:RegularExpressionValidator ID="RESalesTeam" runat="server"  ControlToValidate="sbSalesTeamLeadEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format  yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VESalesTeam" TargetControlID="RESalesTeam" Width="250px"
                            HighlightCssClass="highlight" />
                            </td>
                    </tr>
                     <tr>
                        <td><asp:Label runat="server" ID="Label43" >Service Team Lead: </asp:Label></td>
                        <td><sb:TextBox runat="server" ID ="sbServiceTeamLeadName" Enabled="false"></sb:TextBox></td>
                        <td>
                        <sb:TextBox runat="server" ID ="sbServiceTeamLeadEmail" Width="350px" Enabled="false" MaxLength="50"></sb:TextBox>
                         <asp:RegularExpressionValidator ID="REServiceEmail" runat="server"  ControlToValidate="sbServiceTeamLeadEmail"
                        Display="None"  ValidationExpression="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$"
                        ErrorMessage="Email must be in valid format yourname@COMPANYNAME.com"/>
                        <ajax:ValidatorCalloutExtender runat="Server" ID="VEServiceEmail" TargetControlID="REServiceEmail" Width="250px"
                            HighlightCssClass="highlight" />
                        </td>
                    </tr>
 
                </table>
            </fieldset>
0
Comment
Question by:Steege
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Steege earned 0 total points
ID: 22723536
all i had to do was SetFocusOnError="true" on all the reg  expression validators and it work
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question