Form View Firing Update Event in C#

Posted on 2007-08-03
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
    LVL 16

    Accepted Solution

    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.
    LVL 3

    Author Comment

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

    Expert Comment

    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

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now