Why is my event handler class not fireing?
I have the following:
ASPX:
<asp:GridView ID="vwPatient" runat="server" OnRowDeleted="GridView_Row
Deleted" AutoGenerateDeleteButton="
True">
Code Behind:
protected void GridView_RowDeleted(Object
src, GridViewDeletedEventArgs e)
{
if (e.Exception == null)
{
if (e.AffectedRows == 1)
{
lblInfoPatient.Visible = true;
lblInfoPatient.Text = "Record deleted successfully.";
}
else
{
lblInfoPatient.Visible = true;
lblInfoPatient.Text = "An error occurred during the delete operation.";
}
}
else
{
lblInfoPatient.Visible = true;
lblInfoPatient.Text = e.Exception.Message;
e.ExceptionHandled = true;
}
}
But yet I receive the following error:
The GridView 'vwPatient' fired event RowDeleting 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 'vwPatient' fired event RowDeleting which wasn't handled.]
System.Web.UI.WebControls.
GridView.O
nRowDeleti
ng(GridVie
wDeleteEve
ntArgs e) +1494719
System.Web.UI.WebControls.
GridView.H
andleDelet
e(GridView
Row row, Int32 rowIndex) +604
System.Web.UI.WebControls.
GridView.H
andleEvent
(EventArgs
e, Boolean causesValidation, String validationGroup) +1134
System.Web.UI.WebControls.
GridView.R
aisePostBa
ckEvent(St
ring eventArgument) +199
System.Web.UI.WebControls.
GridView.S
ystem.Web.
UI.IPostBa
ckEventHan
dler.Raise
PostBackEv
ent(String
eventArgument) +7
System.Web.UI.Page.RaisePo
stBackEven
t(IPostBac
kEventHand
ler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePo
stBackEven
t(NameValu
eCollectio
n postData) +177
System.Web.UI.Page.Process
RequestMai
n(Boolean includeStagesBeforeAsyncPo
int, Boolean includeStagesAfterAsyncPoi
nt) +1746
Start Free Trial