473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 2353
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: claire | last post by:
Hi, I have a windows form with a datagrid. The datagrid is bound to a typed dataset. Is there a built in validation function for windows forms? To validate the text boxes i have extended the...
2
by: Niclas Lindblom | last post by:
Hi, I have a datagrid with linkbuttons. I would like to catch the click event when a link button has been clicked and use the string from the text value of the link button in a clientside Java...
2
by: Matthias Marx | last post by:
Hello NG ASP:NET c# 1.1 I have to develop an existing c#, web application. There is a datagrid. With the Edit/Update function, where you could edit the value within the row. I need a...
2
by: Shankar Mani via DotNetMonster.com | last post by:
Hi folks, I am facing a problem while using a DataGrid. I have a webform with a datagrid containing two text boxes for edit viz., countrycode and country name. Like wise I have two more text boxes...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
1
by: MattC | last post by:
I have a user control that contains several requiredFieldValidators. The page the control sits in has other RequiredFieldValidators. On submitting the form all the validators on the page fire and...
2
by: Doc Dunning | last post by:
Hi all, This seems such a simple problem to me but I can't find the answer after *much* searching. I have an application using bound controls to browse / update a database table of club...
1
by: Ganesh Muthuvelu | last post by:
Hello, I am using a Repeater control to display data and also allow data editing. I simply have text boxes in my repeater template and allow the user to make changes as needed.. I also allow...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.