Validation in Gridview - ASP.NET

Discussion in 'ASP .Net Web Controls' started by Guido Pederzini, Aug 4, 2008.

  1. Hi all,
    my problem is in the validation of a textbox in a gridview. I have to check
    a quantity that must be a positive number greater than zero.

    In the XML I have used in a ItemTemplate a TextBox with
    1) RequiredFieldValidator (for the existence)
    2) CompareValidator (for the positive number)
    3) RegularExpressionValidator (it's must be a number)

    The problem is that when I fire the "OnClick" event , all the textbox in the
    gridview display the error message associated to the failed validation, and I
    want that only the row in which I have clicked display it.

    I've found a workaround, in the code behind i check all the rules and I
    display an alert with Javascript, but I would know if it's possible to
    control, with the asp.net validator, only the row that fired the onclick
    event.

    Any help will be appreciated. Thanks!
    Guido Pederzini
     
    Guido Pederzini, Aug 4, 2008
    #1
    1. Advertisements

  2. You can put each control in its own validation group.
     
    randy.buchholz, Aug 8, 2008
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...