laws mandating on property improvement - The formview fired event itemupdating which wasn t handled

Regards, Rob What i would do is check for the primary key in the database in the Item Inserting event handler and then set e. between the time the check is done and the time the insert is done, another user can insert a record. just in the instance I goofed) the business rule is "cannot have duplicate 'code values'". Though maybe I'll have to hide the Form View, display a message about a duplicate, and the user can click Back on the browser. I'd rather have a consistent mechanism for reporting "validation" problems to a user (ala a Validation Summary). Rob The way i see it the main rpoblem with catching the exception is that as far as ASP is concerned the Data Insert has completed, so all the values entered are lost.Cancel to true, that way an excpetion never gets generated and you return to the Form View in inserting mode with all values maintained. So whether or not the 'code value' is a PK or not, the database will throw a constraint violation (uniqueness). If you do it the way i sugested, check every value that has to be unique according to your busines rules and catch the exception any way.

If the user enters a duplicate the database complains about a primary key violation (which is what I want) and an exception is thrown.

The On Inserted event of the Sql Data Source provides access to the exception so, presumably, you can provide nice handling for various errors.

In my opinion there are very few good reasons for allowing this, the only one i can think of off hand is username in an acl type table. a simple Form View/Sql Data Source to handle inserting records into a table.

What I'd like to do is indicate that the page is invalid and have a validation summary displayed along with a polite error message (ala "Cannot insert duplicate record! what is the correct way of handling a PK violation using Form View and Sql Data Source? Secondly regardless of the advisability of letting users enter primary key values (which I tend not to allow...

without giving a datasource to details view, because it is very easy.