Hi can anyone tell me what this error means? "No overload for 'GridView1_RowDeleting' matches delegate 'System.Web.UI.Webcontrols.GridViewDeleteEventHandler'
what im trying to do is catch a sql exception in the code behind for a imagebutton on a GridView (imageButton exists inside a TemplateField). Im getting the error above for this code below. If anyone can help me out that would be great.
gcp2985
Member
45 Points
147 Posts
No overload for GridView1_RowDeleting Error
Mar 27, 2008 10:49 AM|LINK
Hi can anyone tell me what this error means? "No overload for 'GridView1_RowDeleting' matches delegate 'System.Web.UI.Webcontrols.GridViewDeleteEventHandler'
what im trying to do is catch a sql exception in the code behind for a imagebutton on a GridView (imageButton exists inside a TemplateField). Im getting the error above for this code below. If anyone can help me out that would be great.
<
asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="authorID" DataSourceID="ManageAuthorsSqlDataSource" CellPadding="4" ForeColor="#333333" GridLines="None" Width="280px" OnRowDeleting="GridView1_RowDeleting">...
<asp
:TemplateField ShowHeader="False"><ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" OnClientClick="return confirm('Are you sure you want to delete this Author?');" CommandName="Delete" ImageUrl="~/Images/bullet_cross.png"/> </ItemTemplate><HeaderStyle BackColor="White" HorizontalAlign="Center" /><ItemStyle HorizontalAlign="Center" /> </asp:TemplateField>and code behind:
protected void GridView1_RowDeleting(object sender, GridViewDeletedEventArgs e){ if (e.Exception is SqlException){ ClientScript.RegisterStartupScript(this.GetType(), "script", "alert('error')", true);e.ExceptionHandled = true;}
else{ //do nothing atm}
}
ecbruck
All-Star
98783 Points
9691 Posts
Moderator
Re: No overload for GridView1_RowDeleting Error
Mar 27, 2008 12:24 PM|LINK
GridViewDeleteEventArgs
instead of
GridViewDeletedEventArgs
Microsoft MVP - ASP.NET