declaritive or code behind eventhandler assignment?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it better to assign eventhandlers in codebehind:
this.Button1.Click += new EventHandler(Button1_Click);

or delcaritive:
<asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Button" />

Or does it matter either way; and if so, why?. I've been doing it in
codebind, but I'm thinking about switching to declaritve.

Thanks
 
Phil,
I doubt it makes much difference, since you are going to get/need an event
handler method in either case.
Whatever your individual coding style dictates.

Personally I prefer using the "Lighting bolt" events page of the Properties
window for a control, since I know the IDE won't make any typing boo-boos.
Peter
 
Thanks for the reply. That's what I was thinking about moving to, guess I'll
give it a try.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top