Edit DetailsView with regular expression validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elenabul
    New Member
    • Dec 2010
    • 1

    #1

    Edit DetailsView with regular expression validation

    Edit DetailsView with regular expression validation
    Hi, I have a problem using the regular expression validation.
    In a detailed view I fill out a form to create record for an Employee.
    I have to enter the Zip code. To validate it I use the regular expression
    Then I want to edit the record later. I don’t want to edit the zip code.Tt’s bounded from the select
    But the update is keeping asking to re-enter the code.

    Code:
     <EditItemTemplate>
                                       <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SIN") %>' 
                                           ontextchanged="TextBox1_TextChanged"></asp:TextBox>
                                       <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                           ControlToValidate="TextBox1" ErrorMessage="SIN required" 
                                           Text='*' 
                                           ValidationExpression="\d{3}-\d{2}-\d{4}"></asp:RegularExpressionValidator>
                                       <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                           ControlToValidate="TextBox1" ErrorMessage="SIN is not Valid" 
                                           ValidationExpression="\d{3}-\d{2}-\d{4}">___-__-____</asp:RegularExpressionValidator>
                                       <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                           ControlToValidate="TextBox1" ErrorMessage="SIN is required"></asp:RequiredFieldValidator>
                                   </EditItemTemplate>
    Last edited by jhardman; Dec 13 '10, 06:06 AM. Reason: Accidentally posted in the classic asp forum - moved to asp.net
Working...