Solved

asp.net 2010 vb formview

Posted on 2012-03-26
2
233 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
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Red error squiggly on vb.net 7 27
Not showing page correctly 3 29
SQL Login 17 37
SQL Exceptions 3 35
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now