Solved

Multiple RegularExpressionValidator and ValidatorCalloutExtender

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

825 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