ValidationSummary not displaying error message from datagrid regularExpressionValidator

Discussion in 'ASP .Net Datagrid Control' started by Markus, Mar 2, 2005.

  1. Markus

    Markus Guest

    I have a datagrid with Edit, Update, Cancel.
    Everything without validation works fine but when the user edits the
    date column I would like the regularExpressionValidator to display the
    error message in the ValidationSummary when incorrect

    Any help is appreciated.

    <asp:datagrid
    id="dgTrainingDates"
    CssClass="btc_formBlackL"
    Runat="server"
    DataKeyField="Training_ID" OnCancelCommand="dgTrainingDates_CancelCommand"
    OnUpdateCommand="dgTrainingDates_UpdateCommand"
    OnEditCommand="dgTrainingDates_EditCommand"
    GridLines="None"
    BorderWidth="0"
    BorderStyle="NotSet"
    AutoGenerateColumns="False"
    EnableViewState="true">

    <Columns>
    <asp:TemplateColumn>
    <HeaderStyle CssClass="btc_formPurpleL"></HeaderStyle>
    <HeaderTemplate>Training Dates</HeaderTemplate>

    <ItemTemplate><%# container.dataitem("TrainingDate")%></ItemTemplate>

    <EditItemTemplate>
    <asp:TextBox id="UdateTrainingDate" CssClass="btc_formBlackL"
    Runat="server" Width="90"
    Columns="8"
    Text='<%# container.dataItem("TrainingDate")%>'
    EnableViewState="True">
    </asp:TextBox>
    <asp:RegularExpressionValidator
    id="reg1"
    CssClass="btc_loginErr"
    Runat="server"
    ControlToValidate="UdateTrainingDate"
    Text="*"
    ErrorMessage="Please enter a valid date (MM/DD/YYYY)"
    display="none"
    ValidationExpression="^(?:\s+)?(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|
    (?=\d)))?(((0?[1-9]|1[012]):)[0-5]\d){0,2}(
    [AP]M))|([01]\d|2[0-3]):)[0-5]\d){1,2})?(?:\s+)?$">
    </asp:RegularExpressionValidator>

    </EditItemTemplate>
    </asp:TemplateColumn>

    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
    CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>

    </Columns>

    </asp:datagrid>


    <asp:validationsummary id="ValidationSummary1"
    runat="server"
    CssClass="btc_loginErr"
    EnableClientScript="true"
    displaymode="List"
    headertext="There are problems with the following form fields:"
    showmessagebox="false"
    showsummary="True"></asp:validationsummary>
    Markus, Mar 2, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=
    Replies:
    1
    Views:
    412
    Peter Blum
    Apr 5, 2004
  2. =?Utf-8?B?YzY3NjIyOA==?=
    Replies:
    2
    Views:
    6,529
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Jan 13, 2006
  3. dsmportal
    Replies:
    0
    Views:
    542
    dsmportal
    Oct 25, 2006
  4. marc

    ValidationSummary doesn't get nested control error message

    marc, Feb 4, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    194
    Alessandro Zifiglio
    Feb 5, 2004
  5. Fabiano
    Replies:
    0
    Views:
    117
    Fabiano
    Aug 23, 2004
Loading...

Share This Page