Null Pointer
Null Pointer

Reputation: 9309

Error on compiling a grid view

I'm having a strange issue with getting my GridView - RowDataBound method to compile. I've got a simple GridView with the following:

<asp:GridView ID="gv_View_Documents" runat="server" AllowSorting="true" 
  DataKeyNames="DocumentName,Description" AutoGenerateColumns="false" 
  OnSorting="gv_View_Documents_Sorting" OnRowCancelingEdit="gv_View_Documents_RowCancelingEdit"  
  OnRowDataBound="gv_View_Documents_RowDataBound" OnRowEditing="gv_View_Documents_RowEditing" 
  OnRowUpdating="gv_View_Documents_RowUpdating">

When I compile, it shows an error shown below.

Compiler Error Message: CS0123: No overload for 'gv_View_Documents_RowDataBound' matches delegate 'System.Web.UI.WebControls.GridViewRowEventHandler'

I have a similar setup for another grid view with no compile issues.

Any ideas? I'm working with C# and ASP.NET

Upvotes: 1

Views: 2172

Answers (2)

Sebastian Br&#243;zda
Sebastian Br&#243;zda

Reputation: 879

I think that you dont have a method (in a code behind) with params: Object sender, GridViewRowEventArgs e

 void gv_View_Documents_RowDataBound(Object sender, GridViewRowEventArgs e)
  {
  }

Upvotes: 2

VinayC
VinayC

Reputation: 49225

Most probably your event handler method signature does not match with GridViewRowEventHandler signature i.e.

public delegate void GridViewRowEventHandler(
    Object sender,
    GridViewRowEventArgs e
)

Most probably, you may have used EventArgs as a parameter in your event handler.

Upvotes: 4

Related Questions