Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Form View Firing Update Event in C#

Posted on 2007-08-03
Medium Priority
Last Modified: 2013-12-17
I've inherited a C# ASP.NET web application and I'm trying to add 5 fields onto a FormView.  One of the fields (in a text box) I want to strip out certain characters on when the form view is submitted.  I tried to use the below event (disregard the confusing naming):

    protected void DetailView_ItemUpdating(Object sender, FormViewUpdateEventArgs e)

The problem is, this event never seems to fire.  In the FormView tag I added the OnItemUpdating="DetailView_ItemUpdating" and even tried adding the below to the Page_Load event:

DetailView.ItemUpdating += new EventHandler(DetailView_ItemUpdating);

I've traditionally used VB.Net as my code behind and never experienced issues wiring up these events.  Where am I going wrong trying to get this event to fire or where would be a better place to update the value of that item before it's committed to the database?
Question by:IUFITS
  • 2
LVL 16

Accepted Solution

TSmooth earned 2000 total points
ID: 19629243
The Item Updating event only fires when the form is submitted using the default "Update" button provided by the form view when it's in Edit mode or if you place your own control and set the CommandName of the control to "Update". This may be why it's not firing for you if you are using some other button/link button etc. to post back.

Author Comment

ID: 19638224
It's using the Update button that's provided on the form view.
LVL 16

Expert Comment

ID: 19638347
Can you paste aspx code within the "EditItemTemplate" of the form view that includes the update button? If it's a lot of code, filter out the irrelevant pieces.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

579 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