Question : asp.net Why does'nt these required fields work. Only the Phone field works?

<%@ Page Language="VB" %>

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



http://www.w3.org/1999/xhtml">

    Untitled Page


   
   

   
      
            
            
      
      
            
            
      
      
            
            
      

      
            
            
      
      
            
            
      
      
            
            
      

                  r ID="valName" Runat="server" ControlToValidate="txtName" ValidationGroup="EventRegContact"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter a Name." />
            

                  r ID="valAddress" Runat="server" ControlToValidate="txtAddress" ValidationGroup="EventRegContact"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter an Address." />
            

                  r ID="valCity" Runat="server" ControlToValidate="txtCity" ValidationGroup="EventRegContact"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter a City." />
            

                  r ID="valZip" Runat="server" ControlToValidate="txtZip" ValidationGroup="EventRegContact"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter a Zip Code." />lidator ID="RegularExpressionValidator1"
                    runat="server" ErrorMessage="You must enter a valid Zip Code." ControlToValidate="txtZip" ValidationGroup="EventRegContact" ValidationExpression="\d{5}(-\d{4})?">gularExpressionValidator>

                  r ID="valPhone" Runat="server" ControlToValidate="txtPhone"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter a Phone number." />
            dator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtPhone"  ValidationGroup="EventRegContact"
                ErrorMessage="You must enter a valid Phone Number. 555-555-5555" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">larExpressionValidator>

                  r ID="valEmail" Runat="server" ControlToValidate="txtEmail" ValidationGroup="EventRegContact"
                        CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
                        ErrorMessage="You must enter an Email address." />
            dator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtEmail" ValidationGroup="EventRegContact"
                ErrorMessage="You must enter a valid email in the form [email protected]." ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">gularExpressionValidator>

   

   
   

Answer : asp.net Why does'nt these required fields work. Only the Phone field works?

thats because you have set ValidationGroup="EventRegContact" for all but your Phone ReqFV and LinkButton.
Set ValidationGroup="EventRegContact" for all involved Validators and the Linkbutton.
Random Solutions  
 
programming4us programming4us