CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Editable Grid: Suppressing empty row insert

Print topic Send  topic

Author Message
Joel Shepherd
Posted: 01/12/2006, 10:58 AM

I have an editable grid in which I'd like to display a set of existing records, plus one additional empty row for adding a single new record. The user could edit an existing row, or enter data in a new row, or both.

The problem I'm having is in the case where the user edits an existing row but does not enter a new row. I'm not sure how to perform the update of the modified row, without attempting to insert the empty "new" row.

I've tried putting a check in the OnValidateRow() event: if key fields for the current row are empty, I set the grid's InsertAllowed property to false. What happens is that the first time I hit Submit, nothing is submitted but the page comes back without the empty additional row. The second time I hit Submit, the modified row is updated correctly.

So, if the user has left new row empty and made updates to an existing row, how do I do the updates on the first submit, while not attempting to insert the empty new row? (ASP, if it matters.)

Thanks -- Joel.

PS: I'm a relatively new user of CCS and have to say this is the first software product I've used in a long time that actually exceeds my expectations. You guys have done a great job. :-)
peterr


Posts: 5971
Posted: 01/12/2006, 12:00 PM

I think that empty/new rows are never submitted, unless the application detected some values being assigned to fields in those "empty" rows.
Are you maybe using checkboxes as one of your fields?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joel Shepherd
Posted: 01/12/2006, 12:20 PM

Hi Peter - I'm pretty sure the code is attempting to insert the new/empty rows.

If I update an existing row and then hit Submit, the update doesn't take place, and errors about required values in various fields appear above the empty row.

I'm not using any checkboxes.

Thanks -- Joel.
Joel Shepherd
Posted: 01/12/2006, 4:21 PM

Okay, I was half-right, but half-wrong and barking up the wrong tree besides.

The errors I mention above come from the validation code, not as a result of a failed database update. I fixed that problem on my end, and that revealed the real problem.

After some digging, I realized that the real problem was that CCS was looking at several hidden fields (with default values) in the new row when it was trying to determine if the row was empty or not. Because of the defaulted hidden fields, the generated code determined that the row wasn't empty and tried to insert it. The first step to fixing the problem (since I need the hidden fields w/defaults) was to comment out the "IsEmptyRow" code that referenced those fields.

Once I did that, then my original strategy of setting InsertAllowed = false in the OnValidateRow() event worked as desired.

Alrighty, back to business. Thanks -- Joel.
TheunisP

Posts: 342
Posted: 01/13/2006, 3:59 PM

J, I found that it seems easier to use a custom insert, and then defining your default fields there - rather than in the form itself easier - one can also assume this way would be faster - since less data is moved once the clients click submit

View profile  Send private message
srinivask15
Posted: 02/06/2006, 4:31 AM

8-):-D8-):*):-/:-{}:-X:-O:-@O:):-P:-<:-(:-|

HI SEENU

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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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