Adding EventHandlers to a webform

  • Thread starter Thread starter DKode
  • Start date Start date
D

DKode

Just curious,

What is the proper way to add event handlers for web controls in a
ascx/aspx page in csharp?

The way I've been doing it up until this point is adding the +=
eventhandler in the Page_Init method.

Is there a more effecient way/proper way to do this?

thanks
 
DKode,

Nope, that's pretty much it. An event in an ASP.NET page is the same as
an event anywhere else in C#, and the way you attach to events is using the
+= syntax when you want to hook up to the event.

Hope this helps.
 
Thank you nicholas,

that answers my question.

csharp seems to be a much more effecient syntax wise than vb.net and
coming from perl/php, the syntax is closer than vb.

I appreciate your help. Thank you!

Nicholas Paldino said:
DKode,

Nope, that's pretty much it. An event in an ASP.NET page is the same as
an event anywhere else in C#, and the way you attach to events is using the
+= syntax when you want to hook up to the event.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

DKode said:
Just curious,

What is the proper way to add event handlers for web controls in a
ascx/aspx page in csharp?

The way I've been doing it up until this point is adding the +=
eventhandler in the Page_Init method.

Is there a more effecient way/proper way to do this?

thanks
 
Back
Top