Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:36:26+00:00 2026-06-14T15:36:26+00:00

Pardon my ignorance of delegates. I’m trying to register a handler for a GridView

  • 0

Pardon my ignorance of delegates. I’m trying to register a handler for a GridView event in an asp.net WinForms page:

Class myClass
{
    void grid_rowDataBound(object sender, GridViewCommandEventArgs e)
    { blah blah }
}

myClass myClassInstance = new myClass(); //done in Page_Load

<asp:GridView ID="server_grid" runat="server" OnRowDataBound="myClassInstance.grid_RowDataBound">
    yadda yadda
</asp:GridView>

I am getting a runtime error “Delegate to an instance method cannot have null ‘this'”. My only solution at this point is to define a new page function that simply calls my class method and register that page function in OnRowDataBound. But isn’t there a direct way to register a class method for GridView events without the indirection? Or do all page contol events require handlers defined in the page class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:36:27+00:00Added an answer on June 14, 2026 at 3:36 pm

    You could use the following, but then this is just a short way of defining a new function like you already suggested.

    server_grid.RowDataBound += (s,e) => myClassInstance.grid_RowDataBound(s, e);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi pardon my ignorance i'm coming from an apache background. On IIS/ASP.NET (.NET 4.0)
I'm brand new to .net MVC3 so pardon my ignorance. I have a relatively
I am new to the world of ASP.NET and SQL server, so please pardon
Pardon my ASP ignorance, but what's the difference?
Pardon my ignorance, but I've never really developed Windows applications. How do you store
Please pardon my ignorance. I'm looking for a point in the right direction. I
I am noob with php so pardon my ignorance. I have created php form
Pardon me if it is nave; but i am trying to set a property
I am sort of new to MVC so pardon my ignorance. I am using
Pardon my ignorance, I do not know much about AD (let lone querying with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.