Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:17:53+00:00 2026-05-24T14:17:53+00:00

I have an commandfield and few templatefields. The templatefields have validators attached to it

  • 0

I have an commandfield and few templatefields. The templatefields have validators attached to it and they show up proper messages when wrong data is selected. However when I click commandfield no error is shown and the event fires even though data is invalid. Morover, I have also checked Page.IsValid on server and all works out well even though data is in invalid state. This the markup:

<asp:TemplateField HeaderText="Exp. Date">
    <ItemTemplate>
        <asp:Label ID="lblExpiration" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Expiration")%>'></asp:Label>
    </ItemTemplate>
    <EditItemTemplate  >
        <asp:DropDownList ID="ddlMM" runat="server" ValidationGroup="vgExpDateGrid">
            <asp:ListItem Value="-1">MM</asp:ListItem>
            <asp:ListItem Value="1" >01</asp:ListItem>
            <asp:ListItem Value="2">02</asp:ListItem>
            <asp:ListItem Value="3">03</asp:ListItem>
            <asp:ListItem Value="4">04</asp:ListItem>
            <asp:ListItem Value="5">05</asp:ListItem>
            <asp:ListItem Value="6">06</asp:ListItem>
            <asp:ListItem Value="7">07</asp:ListItem>
            <asp:ListItem Value="8">08</asp:ListItem>
            <asp:ListItem Value="9">09</asp:ListItem>
            <asp:ListItem Value="10">10</asp:ListItem>
            <asp:ListItem Value="11">11</asp:ListItem>
            <asp:ListItem Value="12">12</asp:ListItem>
        </asp:DropDownList>
        <span class="green"></span> /&nbsp;
        <asp:DropDownList ID="ddlYY" runat="server" ValidationGroup="vgExpDateGrid">
        </asp:DropDownList>
        <span class="green"></span>
         <asp:RequiredFieldValidator ID="rfvddlMM" ControlToValidate="ddlMM" Display="Dynamic" InitialValue="-1" runat="server" ValidationGroup="vgExpDateGrid">*</asp:RequiredFieldValidator>
         <asp:RequiredFieldValidator ID="rfvddlYY" ControlToValidate="ddlYY" Display="Dynamic" InitialValue="-1" runat="server" ValidationGroup="vgExpDateGrid">*</asp:RequiredFieldValidator>
    </EditItemTemplate>
</asp:TemplateField>

<asp:CommandField 
 UpdateText="Update" CausesValidation="true"
    HeaderText="Update" ShowEditButton="true" 
    EditText="Update <br/>Exp. Date" ButtonType="Link" />

Please do not pay attention to the weird control names and styles. Basically the template field has dropdownlists of year and month. Year’s drop down list is populated in rowdatabound event. As you can see validators are attached still commandfield works normally. Can anybody tell me what can be the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:17:54+00:00Added an answer on May 24, 2026 at 2:17 pm

    At first glance I would say you do not have ValidationGroup="vgExpDateGrid" on asp:CommandField. Change your commandfield to:

    <asp:CommandField ValidationGroup="vgExpDateGrid"
     UpdateText="Update" CausesValidation="true"
      HeaderText="Update" ShowEditButton="true" 
      EditText="Update <br/>Exp. Date" ButtonType="Link" />
    

    or alternatively remove ValidationGroup from asp:RequiredFieldValidator

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have had to write my first proper multithreaded coded recently, and realised just how
I have an ASP.NET GridView control with two asp:CommandField columns that are both using
I have Silverlight application that retrieves data from the database through a WCF Service.
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
Have just started using Google Chrome , and noticed in parts of our site,
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.