Solved

Multiple RegularExpressionValidator and ValidatorCalloutExtender

Posted on 2008-10-14
1
1,303 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now