Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Redisplay data in DetailsView if error encountered during insert

Reply
Thread Tools

Redisplay data in DetailsView if error encountered during insert

 
 
Jim Coyne
Guest
Posts: n/a
 
      11-28-2006
Is there a way to have the data controls re-populated with the previous data
if an error was encountered during an insert?

I currently have the following code to display the error message, but would
like to re-populate the data:

Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertedEvent Args)
If (Not e.Exception Is Nothing) Then
lblStatus.Text = "ERROR: Data not saved."
lblErrorMessage.Text = e.Exception.Message
e.ExceptionHandled = True
Else
Response.Redirect("Default.aspx")
End If
End Sub

I know the user can press "Back" to get the data, but that is not very
user-friendly.

Thanks

Jim


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk insert - error: Unexpected end-of-file (EOF) encountered in data file. AB@ ASP .Net 2 04-17-2007 03:37 PM
Detailsview loses insert mode contents when Insert fails... cannontrodder ASP .Net 1 07-25-2006 08:38 AM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
The server has encountered an error while loading an application during the processing of your reque Pratik kapadia ASP General 1 09-09-2005 03:37 PM
redisplay a page without any of the hyperlinks JPElectron ASP General 4 05-02-2004 04:41 AM



Advertisments