overloading ASP.NET intrinsic event handler methods

J

John A Grandy

For ASP.NET UserControls , is it possible to provide multiple overrides of
the intrinsic handler methods (those for which the delegate that wires the
event to the handler is built-in , such as Init , Load , PreRender ,
Render ) ... ?

I need to create various .ascx controls on-the-fly , calling Init() methods
with different signatures ...

I think the syntax might be :

new public void Init(int param1)
{
Init(param1,string.Empty);
}

new public void Init(int param1, string param2)
{
....
....
}

And the intrisic Init() handler method (which has no params) need not be
explicitly specified.
 
G

Guest

For events like Init, Load and PreRender, you can add a handler like this:

Page.Load += new EventHandler(Load_Method);

Note that every event handler has a particular signature. For the load
method it's:
Load_Method(object sender, EventArgs e)

For methods you can subclass the control and add an event handler to the new
control. From the method you can raise the new event.
 
J

John A Grandy

So for intrinsic events (Init, Load, PreRender) etc. , every EventHandler
delegate you add will have its method triggerred when the event fires ? I
assume they trigger in the order in which they were added to the event.
 

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

Top