473,397 Members | 1,974 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,397 software developers and data experts.

Row by row validation

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 member details. It uses a data grid view to scroll up and
down the list of names, and if I select a row, then some bound text boxes
show the details for the person I've selected. I can edit the text boxes,
and when I click a different row in the grid, any changes I've made are
reflected back into the database. Wonderfully easy to get this far!

But now I want to validate the entries in the text boxes. For example - the
person's surname must not be blank. Seems fair enough to me. I've managed
to find the "rowchanging" event and added the validation in there. I've
been able to add an error provider as well, which uses the "setcolumnerror"
values. If I go back to that record again, t shows a red blob against the
field in error, but ...

.... whatever I do, I can't find how to stop the invalid values being put
back into the dataset :-(. I want to trap the error, point it out to the
user, and have them correct it *before* the row is updated, all before we
navigate away to the next record. This is such common interface design that
it just has to be easy to do, and yet I can't see how.

Any pointers to the solution from out there?

Thanks in advance.
Dec 17 '05 #1
2 2968
Hi,

Take a look at the cellvalidating event

http://msdn2.microsoft.com/en-us/lib...alidating.aspx

Ken
-------------------
"Doc Dunning" <do********@nowhere.net> wrote in message
news:do**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
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 member details. It uses a data grid view to scroll up and
down the list of names, and if I select a row, then some bound text boxes
show the details for the person I've selected. I can edit the text boxes,
and when I click a different row in the grid, any changes I've made are
reflected back into the database. Wonderfully easy to get this far!

But now I want to validate the entries in the text boxes. For example -
the
person's surname must not be blank. Seems fair enough to me. I've
managed
to find the "rowchanging" event and added the validation in there. I've
been able to add an error provider as well, which uses the
"setcolumnerror"
values. If I go back to that record again, t shows a red blob against the
field in error, but ...

... whatever I do, I can't find how to stop the invalid values being put
back into the dataset :-(. I want to trap the error, point it out to the
user, and have them correct it *before* the row is updated, all before we
navigate away to the next record. This is such common interface design
that
it just has to be easy to do, and yet I can't see how.

Any pointers to the solution from out there?

Thanks in advance.

Dec 18 '05 #2
Thanks, Ken ... I'd started to go down that track and it did seem to be the
right way to go. But then I realised that fully bound input boxes are not
the easiest way to do validation anyway, so I'm using the datagrid as a
bound control, and then via the CurrentItemChanged event of the
bindingsource, I can copy data from the dataset current record to my
separate text and combo boxes. Then I have a separate "Save" button which
invokes the validation and if all's OK, a beginedit/endedit routine to put
the textboxes back into the dataset. A bit more code, but much more
flexible (imho).

Martin
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:u%****************@tk2msftngp13.phx.gbl...
Hi,

Take a look at the cellvalidating event

http://msdn2.microsoft.com/en-us/lib...alidating.aspx

Ken
-------------------
"Doc Dunning" <do********@nowhere.net> wrote in message
news:do**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
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 member details. It uses a data grid view to scroll up and
down the list of names, and if I select a row, then some bound text boxes
show the details for the person I've selected. I can edit the text
boxes,
and when I click a different row in the grid, any changes I've made are
reflected back into the database. Wonderfully easy to get this far!

But now I want to validate the entries in the text boxes. For example -
the
person's surname must not be blank. Seems fair enough to me. I've
managed
to find the "rowchanging" event and added the validation in there. I've
been able to add an error provider as well, which uses the
"setcolumnerror"
values. If I go back to that record again, t shows a red blob against
the
field in error, but ...

... whatever I do, I can't find how to stop the invalid values being put
back into the dataset :-(. I want to trap the error, point it out to the
user, and have them correct it *before* the row is updated, all before we
navigate away to the next record. This is such common interface design
that
it just has to be easy to do, and yet I can't see how.

Any pointers to the solution from out there?

Thanks in advance.


Dec 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
4
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
6
by: Stephen | last post by:
Hi, the validation controls dont work on Netscape or Mozilla and only on Internet Explorer why? How do i correct this problem? Thanks
7
by: Ryan Ternier | last post by:
We're running a site that has required field validation on the login page. It works fine on our development / test machines. However, when I upload this site to our live server i get this error. ...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
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...
2
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation....
6
by: Jon Paal | last post by:
validation doesn't fire what's missing ????? /////// ---- code -----/////////////////////////// Sub btnSubmit_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) 'Handles...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.