I'm using a stored procedure that returns an error message if the inserted/updated data violates certain criteria. (name already exists...etc)
I'm able to get the message back fine using
...but I also want to keep the insert/edit form in the grid from clearing the data the user was trying to enter.
Any ideas on how to accomplish this?
Once again, thanks to everyone for the continued guidance.
I'm able to get the message back fine using
Protected
Sub
GridViewDataSource_Inserted(
ByVal
sender
As
Object
,
ByVal
e
As
SqlDataSourceStatusEventArgs)
Handles
GridViewDataSource.Inserted
Dim
command
As
DbCommand
command = e.Command
If
Not
e.Exception
Is
Nothing
Then
e.ExceptionHandled =
True
SetMessage(
"Data cannot be inserted. Reason: "
+ e.Exception.Message)
Else
If
command.Parameters(
"@RetMsg"
).Value.ToString().Length > 0
Then
SetMessage(
"Data cannot be inserted. Reason: "
+ command.Parameters(
"@RetMsg"
).Value.ToString())
Else
SetMessage(
"New data has been inserted"
)
End
If
End
If
End
Sub
...but I also want to keep the insert/edit form in the grid from clearing the data the user was trying to enter.
Any ideas on how to accomplish this?
Once again, thanks to everyone for the continued guidance.