Use the RequiredFieldValidator on each textbox.
If you have multiple rows, each showing textboxes at the same time and you
only want the row being submitted to validate, you need "validation groups".
This is a feature introduced in ASP.NET 2.0 and already in my Professional
Validation And More (
http://www.peterblum.com/vam/home.aspx) which is a
replacement to the Microsoft validators that greatly expands the
capabilities of validation and improves data entry web forms.
Validation groups lets you assign a group name to a submit button and its
list of validators so it only fires the validators on its list. My
Professional Validation And More is available for ASP.NET 1.x and does this
task better than ASP.NET 2.0's validators because it can automatically
create unique group names for each row in the datagrid.
Remember to always support server side validation by testing Page.IsValid is
true in the post back event handler for the submit button that validates.
--- Peter Blum
www.PeterBlum.com
Email:
PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Kris" <kr**@freemail.com> wrote in message
news:ek**************@TK2MSFTNGP15.phx.gbl...
Hi,
I have a DataGrid where in each row has couple of text boxes and an
update button. Each row is dynamically generated as the number of rows are
not known ahead of time. When the user clicks the update button, I do a
postback to capture the data entered. However I dont want to do a postback
when the textboxes are empty. How do I prevent this using Clientside
validation? This is a common problem and if it has been beaten to death,
please bear with me as I am new to Web Development. Thanks in advance for
any tips or pointers.
Kris.