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

  • Home
  • SEARCH
  • 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 490949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:57:40+00:00 2026-05-13T01:57:40+00:00

A typical situation: In my GridView control, I have a Footer row which contains

  • 0

A typical situation:

In my GridView control, I have a Footer row which contains a Textbox and an “Add” Button. When the button is pushed, the Text entered in the TextBox is added to the grid. I also have a validation control to require that, when the button is pushed, that text has been entered in the TextBox. After a new row is added, the textbox is clear to allow for easy entry of the next item.

The user may also edit the text in previously entered rows by clicking the Edit LinkButton, which puts the row into edit mode. Clicking an Update LinkButton commits the change.

The problem:

When, I click the Update link to commit the changes, if text has not been entered in the Footer row’s TextBox (the row used to add a new entry), the validation control returns a “Entry Required” error. It should only require an entry if the Add button is pushed, not if the Update LinkButton is pushed.

It seems that the server side Validation control’s validating event fires before the GridView’s RowCommand event or the btnAdd_Click event, so I am wondering how, from the server, I can determine what event fired the postback so I can determine whether what edits should be performed for the given situation.

I am using a mix of client side “required” validation edits as well as more complex server sides. Since I probably have to have some server sided validations, I would be happy with just knowing how to handle server sided validations, but really, know how to handle this situation for client validations would also be helpful.

Thanks.

  • 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-13T01:57:40+00:00Added an answer on May 13, 2026 at 1:57 am

    Convert your CommandField into a TemplateField, and in the EditItemTemplate, change the Update LinkButton’s CausesValidation property to false.

    Update:

    Converting to a TemplateField is simple and doesn’t require any code changes (just markup):

    alt text

    Changing the CausesValidation property to false in the markup is also straightforward:

    <asp:TemplateField ShowHeader="False">
      <EditItemTemplate>
        <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="False"
          CommandName="Update" Text="Update"></asp:LinkButton>
        <%--
          More controls
        --%>
      </EditItemTemplate>
      <ItemTemplate>
        <%--
          Controls
        --%>
      </ItemTemplate>
    </asp:TemplateField>
    

    Now, if you want your footer and data rows to be validated separately, you need to use validation groups, which is explained in Microsoft’s documentation. All the controls in the same validation group will have their ValidationGroup property set to the same value, like this:

    <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True"
      CommandName="Update" Text="Update" ValidationGroup="GridViewDataRowGroup">
    </asp:LinkButton>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very typical situation. We have a table called Users which has
I have a typical definition/instance situation in my data modeling. I'm trying to store
Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be
I have typical situation where big loop is loading lots of images and its
I have a very typical situation in any application, where i have the following
I have a Java RMI system. The situation is typical: the client invokes a
current situation: I have a service with several typical service methods like create(), remove(),
I have a typical situation, where I need pull multiple rows from mysql by
I have a typical situation. my table has four column. (id, user, col2, status)
Im using a typical situation with UINavigationController, id like to make the navigation bar

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.