?
Solved

asp.net 2010 vb formview

Posted on 2012-03-26
2
Medium Priority
?
240 Views
Last Modified: 2012-04-02
I have a formview that does an insert.  When user inserts a duplicate key, it errors out, how can I catch this?  Something like this?

formview1.itemInserting.......
label1.text = "Item already exists"
end sub

I just can seem to find the right event.
0
Comment
Question by:bergertime
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37767306
you can use on text change event of textbox,
0
 
LVL 9

Accepted Solution

by:
gery128 earned 2000 total points
ID: 37769926
you might want to try FormView_ItemInserted event in which you can check EventArgs for proper information if the item has inserted or not.
here is some sample code:


protected void MyFormView_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
      if (e.Exception != null)
      {
            // display exception
            lblException.Text = e.Exception.ToString();
            e.KeepInInsertMode = true;
            e.ExceptionHandled = true;
       }
}

Open in new window

from below link:

http://www.issociate.de/board/post/476944/Formview_and_Sql_Error_Trapping_and_Page_Validation....html
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question