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 981559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:33:39+00:00 2026-05-16T04:33:39+00:00

In doing a lot of ASP.NET pages (.NET 2.0), my codebehind is typically packed

  • 0

In doing a lot of ASP.NET pages (.NET 2.0), my codebehind is typically packed with event handlers on page objects. GridView_RowCommand, Button_Click, etc. All the usual suspects. One thing all EventHandler derived things have in common is that their first argument is an object, typically labeled “sender”.

In ASP.NET codebehind, I really don’t see the point of it. If I have GridCustomers_RowCommand and I need to do something to GridCustomers, I can just access it from the codebehind instead of worrying about casting sender to a gridview and then working with it.

I feel like I must be missing a very important design consideration here. Am I doing something stinky to my code? I kind of can see that using direct references this way is falling prey to global objects, but that’s just how ASP.NET works! What am I not seeing here? Is there some superb book or tutorial that shows how to use ASP.NET the “right way?” The clean, agile, “real coder” way?

  • 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-05-16T04:33:40+00:00Added an answer on May 16, 2026 at 4:33 am

    You might have one event handler for DRY coding, yet 20 things that use that event, for example:

    protected void AddClass(object sender, EventArgs e) {
       ((WebControl)sender).CssClass += " myNewClass";
    }
    

    In this case you’re writing the code once, but it can be used by many WebControls (this is an example, the point is not specific to WebControls at all).

    Disclaimer: Do I use sender every day? no not even close, is it useful? yes it can be 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net page within which I've used several AJAX controls doing partial
I have an ASP.net WebForms page that has a lot of content on the
I'm doing some diagnostic logging in the Page_Unload event in an asp.net application, this
I am doing a lot of image processing in GDI+ in .NET in an
I've been doing a lot of research on web platforms (mainly .Net vs Java),
I am trying to call a javascript function from asp.net codebehind using onclientclick for
I have an asp.net website which contains a few pages that I'd like to
One thing I don't understand with sending Async emails from ASP.NET page is when
I'm trying to create a page where a listbox will contain all my ASP.NET
I am currently working on a mobile web page in asp.Net MVC2 that allows

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.