Tuesday, August 3, 2010

The grid view fired event which wasn't handled

You may experience this error when you are handling the ItemCommand instead of handing the RowEditing event.

This happens to me when I name my CommandName "Edit". The following is the message I got when run my web application and click on any Edit Button.

My Solution
  • Do not use word "Edit" as a CommandName
My GUI:

Id Name Address
Edit 1 Jonh NY
Edit 2 Nanny NY
Edit 3 Bob NY

Message Error

The GridView 'dg' fired event RowEditing 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 GridView 'dg' fired event RowEditing 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.

Stack Trace:

[HttpException (0x80004005): The GridView 'dg' fired event RowEditing which wasn't handled.]
System.Web.UI.WebControls.GridView.OnRowEditing(GridViewEditEventArgs e) +1463273
System.Web.UI.WebControls.GridView.HandleEdit(Int32 rowIndex) +43
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +589
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +121
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

My Code











0 comments:

Post a Comment