470,586 Members | 1,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

Clientside validation for DataGrid's text boxes

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.
Nov 19 '05 #1
1 2238
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.

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by claire | last post: by
2 posts views Thread by Niclas Lindblom | last post: by
2 posts views Thread by Matthias Marx | last post: by
2 posts views Thread by Shankar Mani via DotNetMonster.com | last post: by
1 post views Thread by MattC | last post: by
2 posts views Thread by Doc Dunning | last post: by
1 post views Thread by Ganesh Muthuvelu | last post: by
7 posts views Thread by mc | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.