|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AddHandler / Remove Handler?If you instantiate a web control programmatically in Form_Load and then add
a click event handler to it using AddHandler MyControl.Click AddressOf MyEventHandler, is it necessary to call RemoveHandler MyControl.Click AddressOf MyEventHandler in the Page_Unload event? Does not removing handlers have any side effects? Thanks Tim In ASP.NET, no, it's not necessary. You typically only do this if your ccode
that was receiving the event is still running and you no longer want to receive the event. Since ASP.NET creates a page for every request, the page and all the child contorls are thrown away so no need to stop receiving the event as the source of the event is gone itself, so to speak. -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > If you instantiate a web control programmatically in Form_Load and > then add > a click event handler to it using AddHandler MyControl.Click AddressOf > MyEventHandler, is it necessary to call RemoveHandler MyControl.Click > AddressOf MyEventHandler in the Page_Unload event? Does not removing > handlers have any side effects? > Thanks > Tim No, that's not necessary in ASP.NET, and it has no real effect.
Show quoteHide quote "Tim" <t**@nowhere.org> wrote in message news:eo2TdAcQFHA.2252@TK2MSFTNGP15.phx.gbl... > If you instantiate a web control programmatically in Form_Load and then > add > a click event handler to it using AddHandler MyControl.Click AddressOf > MyEventHandler, is it necessary to call RemoveHandler MyControl.Click > AddressOf MyEventHandler in the Page_Unload event? Does not removing > handlers have any side effects? > Thanks > Tim > >
Customizing ASP.NEt Hyperlink Control
Need Click Event to Fire from TextBox How to validate one of two Required TextBox Defining server-side Click event for Label web contol ? Urgent! GridView and templated controls binding---------Plz help how to display records in datagrid TemplateControl?? Dynamic loadcontrol of ascx with dll not in bin path Creating a Tab in web form Textboxes with images |
|||||||||||||||||||||||