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,