CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Editable Grid: validate before delete

Print topic Send  topic

Author Message
rho


Posts: 85
Posted: 02/27/2006, 12:53 PM

How do I validate a row in an editable grid and be able to cancel the deletion of the row?

F.e. I want to delete a row *only* if the primary key of the row isn't used in some other table (referential integrity).
I've been trying to use the OnValidateRow() event, but this event isn't triggered for a row that has the Checkbox_Delete control checked. I don't get other events to work either. How can this be done?

Anybody any suggestions/hints/links/tips?

TIA, Rob.
View profile  Send private message
peterr


Posts: 5971
Posted: 02/27/2006, 1:39 PM

Cancelling record updates and deletions is described in the following section of the documentation (Help): "Prevent Operation for Individual Records via Editable Grid".
Hopefully that will work in your case as well.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
rho


Posts: 85
Posted: 02/27/2006, 7:33 PM

Thanks. This gets me started! However, when trying to get to the value of a field on the row to be deleted (e.g. Tasks.User_Name.value), I get the value of the *last* row of the editable grid and not the value of User_Name on the row that is to be deleted. How do I do that?
View profile  Send private message
peterr


Posts: 5971
Posted: 02/27/2006, 9:08 PM

Maybe this post would help: http://forums.codecharge.com/posts.php?post_id=60507
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mhope

Posts: 37
Posted: 02/28/2006, 2:19 AM

Let me see if I understand correctly, you want to delete a row if the primary key (field) isn’t used in another table? If so this should work:

In a before show event would do:
DELETE FROM Table1 WHERE Field1 IN (SELECT DISTINCT Field1 FROM table2)
View profile  Send private message
dragoon


Posts: 173
Posted: 02/28/2006, 7:06 AM

DELETE FROM Table1 WHERE Field1 NOT IN (SELECT DISTINCT Field1 FROM table2)

8-)

Quote mhope:
Let me see if I understand correctly, you want to delete a row if the primary key (field) isn’t used in another table? If so this should work:

In a before show event would do:
DELETE FROM Table1 WHERE Field1 IN (SELECT DISTINCT Field1 FROM table2)

View profile  Send private message
mhope

Posts: 37
Posted: 02/28/2006, 12:10 PM

Yes, sorry forgot the "Not"
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.