Client side validation of a DataGrid

Discussion in 'ASP .Net Datagrid Control' started by Hrvoje Vrbanc, Aug 11, 2003.

  1. Hello all,

    I have a problem that looks simple and I think should be fairly common but
    wasn't able to find a solution yet. Here it is: I have a DataGrid control
    displaying data from a database. There's also a column with empty TextBox
    controls and another one with Button controls in the DataGrid. I would like
    to create a JavaScript client side validation that will check if a number
    has been entered in a TextBox near the Button clicked. The Button's function
    is to put a quantity of a product into a database, quantity of course being
    entered into TextBox. Now, of course the problem isn't in the JavaScript but
    how should I wire the OnClick event of each particular Button to JavaScript
    and how to pass the value (text) of belonging TextBox to JavaScript?


    I have tried plenty of options but if I use DataGrid's
    OnSelectedIndexChanged event, it only initiates JavaScript when the same
    Button is pressed for the second time, if I use OnItemDataBound event, the
    JavaScript gets called but no value is passed from the TextBox to JavaScript
    and if I put validator within the DataGrid in HTML view, it requires all
    TextBox controls to be filled, not just the one near the clicked Button.

    I'm sure there must be an easy way to do it because it seems to me like a
    quite usual requirement.

    Thank you very much in advance,
    Hrvoje
    Hrvoje Vrbanc, Aug 11, 2003
    #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. Libs
    Replies:
    0
    Views:
    1,485
  2. Matt
    Replies:
    14
    Views:
    4,076
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    742
    Kevin Spencer
    Jun 2, 2005
  4. Boss302
    Replies:
    0
    Views:
    1,029
    Boss302
    Nov 21, 2006
  5. Bogdan
    Replies:
    2
    Views:
    639
    Bogdan
    Jun 9, 2008
Loading...

Share This Page