pkrawetz
Posts: 77
|
Posted: 06/07/2004, 3:24 PM |
|
I have an editable grid (the only object on the page) which has 1 empty row when displayed. After adding a row, the page is redisplayed with the new row and one empty row. When I click the delete checkbox and press Submit, I get an SQL error on an insert statement. It appears that the grid is trying insert the empty row. When I redisplay the page, the row which I checked off for deletion was deleted.
How do I stop it from displaying the SQL error on the empty row? This only appears to happen when I have a listbox in the grid. I have another page with an editable grid and only textboxes. That page works just fine.
|
|
|
ghtracey
Posts: 23
|
Posted: 06/07/2004, 3:32 PM |
|
Just out of curiosity (because this sounds familiar :D) do you have any hidden fields in the grid that you set values into?
I ran into the same issue, it was caused by me programmatically setting the values of hidden fields. This caused the engine to think that data had been entered into the form causing an insert to be triggered. I eventually coded a check to see if the hidden fields were all that was set, and if so, setting InsertAllowed false.
_________________
Graham Tracey
Council of Yukon First Nations |
|
|
peterr
Posts: 5971
|
Posted: 06/07/2004, 3:36 PM |
|
Actually if the default value of the ListBox is set to something than it will be submitted and the program will think that the user selected that value. You would need to set the ListBox value to null/blank, so that nothing gets submitted when nothing was selected.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
pkrawetz
Posts: 77
|
Posted: 06/07/2004, 4:30 PM |
|
Bingo. There is a hidden field on the grid. I didn't think that was the problem but the hidden field gets set during the onload event. Thanks for the information. I'll have to try setting InsertAllowed to false.
|
|
|
pkrawetz
Posts: 77
|
Posted: 06/07/2004, 4:32 PM |
|
ghtracey, where did you place the code to set the InsertAllowed to false?
|
|
|
|