Formview event not handled (???)

Discussion in 'ASP .Net Web Controls' started by javelin, Jun 21, 2007.

  1. javelin

    javelin Guest

    Since I haven't had any success manually updating this formview, I
    thought I'd repost on another route I'm trying. To recap, I am
    manually binding to a datasource using the MySQL .NET connector, and
    I've been able to run action queries on this database when directly
    coding them. However, I now have the need to update the formview. I've
    tried to use the FormView.UpdateItem(), and then a LinkButton control,
    and in both cases get a "missing event handler" error. Using the
    LinkButton, I get the following:

    The FormView 'fvEditImpRec' fired event ItemUpdating which wasn't
    handled.
    Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The FormView
    'fvEditImpRec' fired event ItemUpdating which wasn't handled.

    Source Error:

    An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of
    the exception can be identified using the exception stack trace
    below.


    [HttpException (0x80004005): The FormView 'fvEditImpRec' fired event
    ItemUpdating which wasn't handled.]

    System.Web.UI.WebControls.FormView.OnItemUpdating(FormViewUpdateEventArgs
    e) +324
    System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
    Boolean causesValidation) +972
    System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
    causesValidation, String validationGroup) +545
    System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source,
    EventArgs e) +163
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    args) +56
    System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
    EventArgs e) +118
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    args) +56
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
    +106
    System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
    eventArgument) +175

    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    eventArgument) +31
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument) +32
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    +242


    Please let me know if anyone has a clue for me, as I'm newer to .NET
    than VB and classic ASP, so I need direction.

    Thanks.
    javelin, Jun 21, 2007
    #1
    1. Advertising

  2. javelin

    Teemu Keiski Guest

    Hi,

    data controls in ASP.NET 2.0, when used through manual databinding just
    require yopu top handle certain events, and they inform it this way.
    Basically, all you need to do is to attach a handler method for ItemUpdating
    event, and that's it.


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "javelin" <> wrote in message
    news:...
    > Since I haven't had any success manually updating this formview, I
    > thought I'd repost on another route I'm trying. To recap, I am
    > manually binding to a datasource using the MySQL .NET connector, and
    > I've been able to run action queries on this database when directly
    > coding them. However, I now have the need to update the formview. I've
    > tried to use the FormView.UpdateItem(), and then a LinkButton control,
    > and in both cases get a "missing event handler" error. Using the
    > LinkButton, I get the following:
    >
    > The FormView 'fvEditImpRec' fired event ItemUpdating which wasn't
    > handled.
    > Description: An unhandled exception occurred during the execution of
    > the current web request. Please review the stack trace for more
    > information about the error and where it originated in the code.
    >
    > Exception Details: System.Web.HttpException: The FormView
    > 'fvEditImpRec' fired event ItemUpdating which wasn't handled.
    >
    > Source Error:
    >
    > An unhandled exception was generated during the execution of the
    > current web request. Information regarding the origin and location of
    > the exception can be identified using the exception stack trace
    > below.
    >
    >
    > [HttpException (0x80004005): The FormView 'fvEditImpRec' fired event
    > ItemUpdating which wasn't handled.]
    >
    > System.Web.UI.WebControls.FormView.OnItemUpdating(FormViewUpdateEventArgs
    > e) +324
    > System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
    > Boolean causesValidation) +972
    > System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
    > causesValidation, String validationGroup) +545
    > System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source,
    > EventArgs e) +163
    > System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > args) +56
    > System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
    > EventArgs e) +118
    > System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > args) +56
    > System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
    > +106
    > System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
    > eventArgument) +175
    >
    > System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    > eventArgument) +31
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > sourceControl, String eventArgument) +32
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > +242
    >
    >
    > Please let me know if anyone has a clue for me, as I'm newer to .NET
    > than VB and classic ASP, so I need direction.
    >
    > Thanks.
    >
    Teemu Keiski, Jun 24, 2007
    #2
    1. Advertising

  3. javelin

    javelin Guest

    I actually did just that, and it did not work. I admit, I don't know
    what to put in the ItemUpdating event, nor the required syntax, but I
    thought it should at least fire off the event once I created it, and
    it doesn't appear to even try. Can you give me a simple example of an
    ItemUpdating event function?



    On Jun 24, 3:07 am, "Teemu Keiski" <> wrote:
    > Hi,
    >
    > data controls in ASP.NET 2.0, when used through manual databinding just
    > require yopu top handle certain events, and they inform it this way.
    > Basically, all you need to do is to attach a handler method for ItemUpdating
    > event, and that's it.
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
    >
    > "javelin" <> wrote in message
    >
    > news:...
    >
    > > Since I haven't had any success manually updating this formview, I
    > > thought I'd repost on another route I'm trying. To recap, I am
    > > manually binding to a datasource using the MySQL .NET connector, and
    > > I've been able to run action queries on this database when directly
    > > coding them. However, I now have the need to update the formview. I've
    > > tried to use the FormView.UpdateItem(), and then a LinkButton control,
    > > and in both cases get a "missing event handler" error. Using the
    > > LinkButton, I get the following:

    >
    > > The FormView 'fvEditImpRec' fired event ItemUpdating which wasn't
    > > handled.
    > > Description: An unhandled exception occurred during the execution of
    > > the current web request. Please review the stack trace for more
    > > information about the error and where it originated in the code.

    >
    > > Exception Details: System.Web.HttpException: The FormView
    > > 'fvEditImpRec' fired event ItemUpdating which wasn't handled.

    >
    > > Source Error:

    >
    > > An unhandled exception was generated during the execution of the
    > > current web request. Information regarding the origin and location of
    > > the exception can be identified using the exception stack trace
    > > below.

    >
    > > [HttpException (0x80004005): The FormView 'fvEditImpRec' fired event
    > > ItemUpdating which wasn't handled.]

    >
    > > System.Web.UI.WebControls.FormView.OnItemUpdating(FormViewUpdateEventArgs
    > > e) +324
    > > System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
    > > Boolean causesValidation) +972
    > > System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
    > > causesValidation, String validationGroup) +545
    > > System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source,
    > > EventArgs e) +163
    > > System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > > args) +56
    > > System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
    > > EventArgs e) +118
    > > System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > > args) +56
    > > System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
    > > +106
    > > System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
    > > eventArgument) +175

    >
    > > System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    > > eventArgument) +31
    > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > > sourceControl, String eventArgument) +32
    > > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > > +242

    >
    > > Please let me know if anyone has a clue for me, as I'm newer to .NET
    > > than VB and classic ASP, so I need direction.

    >
    > > Thanks.
    javelin, Jun 25, 2007
    #3
  4. javelin

    javelin Guest

    Hi, thanks for your reply. I'm not sure what to do with the
    "Employee.UpdateEmployee". Is "Employee" the target table name, or the
    dataset object name?


    On Jun 25, 8:47 am, David R. Longnecker <>
    wrote:
    > Javelin-
    >
    > I prefer to use the FormViewCommandEventArgs to read in the commands. I've
    > never tried it with mySql, but I'm assuming implementation is the same since
    > it's outside the data layer.
    >
    > On your form view, just associate your Update, Edit, Cancel, etc buttons
    > with similar CommandName parameters:
    >
    > <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
    > CommandName="Update" Text="Update" />
    >
    > <asp:LinkButton ID="UpdateCancelButton" runat="server"
    > CausesValidation="False" CommandName="Cancel" Text="Cancel" />
    >
    > Like so... and in your code behind, create an event method for ItemCommand.
    >
    > protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs
    > e)
    > {
    > if (e.CommandName.Equals("Edit"))
    > {
    > FormView1.ChangeMode(FormViewMode.Edit);
    > }
    > else if (e.CommandName.Equals("Cancel"))
    > {
    > FormView1.ChangeMode(FormViewMode.ReadOnly);
    > }
    > else if (e.CommandName.Equals("Update"))
    > {
    > int id = Convert.ToInt32(((Label)FormView1.FindControl("IdLabel")).Text);
    > string name = ((TextBox)FormView1.FindControl("NameTextBox")).Text;
    > string city = ((TextBox)FormView1.FindControl("CityTextBox")).Text;
    > string state = ((TextBox)FormView1.FindControl("StateTextBox")).Text;
    > Employee.UpdateEmployee(id, name, city, state);
    > }
    > }
    >
    > Odd code... was using it for an example in another thread, but same concept...
    > you could place whatever data logic you need to access your database, pass
    > update commands, etc. AFAIK, ItemUpdating is an event that fires just prior
    > to whatever you have specified on the data source object as the UpdateMethod.
    > If you're manually pushing your data into the FormView, then you probably
    > don't have that event.
    >
    > HTH.
    >
    > -dl
    >
    > --
    > David R. Longneckerhttp://blog.tiredstudent.com
    >
    > j> I actually did just that, and it did not work. I admit, I don't know
    > j> what to put in the ItemUpdating event, nor the required syntax, but I
    > j> thought it should at least fire off the event once I created it, and
    > j> it doesn't appear to even try. Can you give me a simple example of an
    > j> ItemUpdating event function?
    > j>
    > j> On Jun 24, 3:07 am, "Teemu Keiski" <> wrote:
    > j>
    >
    > >> Hi,

    >
    > >> data controls in ASP.NET 2.0, when used through manual databinding
    > >> just require yopu top handle certain events, and they inform it this
    > >> way. Basically, all you need to do is to attach a handler method for
    > >> ItemUpdating event, and that's it.

    >
    > >> --
    > >> Teemu Keiski
    > >> AspInsider, ASP.NET
    > >> MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
    > >> "javelin" <> wrote in message

    >
    > >>news:...

    >
    > >>> Since I haven't had any success manually updating this formview, I
    > >>> thought I'd repost on another route I'm trying. To recap, I am
    > >>> manually binding to a datasource using the MySQL .NET connector, and
    > >>> I've been able to run action queries on this database when directly
    > >>> coding them. However, I now have the need to update the formview.
    > >>> I've tried to use the FormView.UpdateItem(), and then a LinkButton
    > >>> control, and in both cases get a "missing event handler" error.
    > >>> Using the LinkButton, I get the following:

    >
    > >>> The FormView 'fvEditImpRec' fired event ItemUpdating which wasn't
    > >>> handled.
    > >>> Description: An unhandled exception occurred during the execution of
    > >>> the current web request. Please review the stack trace for more
    > >>> information about the error and where it originated in the code.
    > >>> Exception Details: System.Web.HttpException: The FormView
    > >>> 'fvEditImpRec' fired event ItemUpdating which wasn't handled.

    >
    > >>> Source Error:

    >
    > >>> An unhandled exception was generated during the execution of the
    > >>> current web request. Information regarding the origin and location
    > >>> of the exception can be identified using the exception stack trace
    > >>> below.

    >
    > >>> [HttpException (0x80004005): The FormView 'fvEditImpRec' fired event
    > >>> ItemUpdating which wasn't handled.]

    >
    > >>> System.Web.UI.WebControls.FormView.OnItemUpdating(FormViewUpdateEven
    > >>> tArgs
    > >>> e) +324
    > >>> System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
    > >>> Boolean causesValidation) +972
    > >>> System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
    > >>> causesValidation, String validationGroup) +545
    > >>> System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source,
    > >>> EventArgs e) +163
    > >>> System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > >>> args) +56
    > >>> System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
    > >>> EventArgs e) +118
    > >>> System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
    > >>> args) +56
    > >>> System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
    > >>> +106
    > >>> System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
    > >>> eventArgument) +175
    > >>> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHan
    > >>> dler.RaisePostBackEvent(String
    > >>> eventArgument) +31
    > >>> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > >>> sourceControl, String eventArgument) +32
    > >>> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > >>> +242
    > >>> Please let me know if anyone has a clue for me, as I'm newer to .NET
    > >>> than VB and classic ASP, so I need direction.

    >
    > >>> Thanks.
    javelin, Jul 2, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sherif ElMetainy

    EndRequest Event is not handled

    Sherif ElMetainy, Aug 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    775
    Sherif ElMetainy
    Aug 30, 2003
  2. sanjay patil via .NET 247

    Previous(Unwanted) event handled when page refreshed by key F5

    sanjay patil via .NET 247, Apr 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    392
    sanjay patil via .NET 247
    Apr 27, 2004
  3. Arjen
    Replies:
    3
    Views:
    68,956
    JackMcKenzie
    Nov 1, 2007
  4. jobs
    Replies:
    0
    Views:
    1,485
  5. rote
    Replies:
    0
    Views:
    1,736
Loading...

Share This Page