Solved

Multiple RegularExpressionValidator and ValidatorCalloutExtender

Posted on 2008-10-14
1
1,301 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
Comment Utility
all i had to do was SetFocusOnError="true" on all the reg  expression validators and it work
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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 …
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

10 Experts available now in Live!

Get 1:1 Help Now