C# – How to add an event handler for events from button in C# from source view (aspx)

asp.netc

What is the easiest way to create code-behind (webforms) event handlers for say a button from HTML source view?

In VB.NET it is quite easy to switch to code behind page and use the object and events combo boxes along the top to select and create.

In c# those are missing (and I really don't like design view).

Best Answer

  • Make sure the Properties window is open.
  • Click anywhere in the element in source view.
  • Click the lightning symbol (events) in the Properties window.
  • Find the event you want to create a handler for.
  • Double click it.
Related Topic