S
stuart.d.jones
Hi,
I have a DetailsView control bound to a SqlDataSource. I've got
everything working nearly as I want, but here's my problem.
I have a table which has a Guid as a Primary Key, and a VarChar field
(a Title) which is also unique. If the user edits the Title field in
the DetailsView to make it a duplicate, and hits Update, an exception
is thrown (SQLException - statement cancelled as it would violate the
key restrictions).
I was under the impression that regardless of the outcome, the
ItemUpdated event of the DetailsView control would fire, and I could
then check the Exception properties of the event arguments, and act
accordingly.
How can I catch these errors - I have no control over the code where
the error's occurring, so I can't put a try-catch block in? Can I do
this, or do I have to faff around making sure they don't happen before
it tries to save the changes? And if I can't do this, when do the
Exception properties of the ItemUpdated event arguments ever get
used...???
Any help much appreciated!
Cheers.
Stuart
I have a DetailsView control bound to a SqlDataSource. I've got
everything working nearly as I want, but here's my problem.
I have a table which has a Guid as a Primary Key, and a VarChar field
(a Title) which is also unique. If the user edits the Title field in
the DetailsView to make it a duplicate, and hits Update, an exception
is thrown (SQLException - statement cancelled as it would violate the
key restrictions).
I was under the impression that regardless of the outcome, the
ItemUpdated event of the DetailsView control would fire, and I could
then check the Exception properties of the event arguments, and act
accordingly.
How can I catch these errors - I have no control over the code where
the error's occurring, so I can't put a try-catch block in? Can I do
this, or do I have to faff around making sure they don't happen before
it tries to save the changes? And if I can't do this, when do the
Exception properties of the ItemUpdated event arguments ever get
used...???
Any help much appreciated!
Cheers.
Stuart