Hi,
you need to expose it as full-blown event, not as property. Page parser in
ASP.NET is then able to wire syntax On<EventName>="handler_method_name" into
your event as listener. Therefore the code would be pretty much like asa
follows. Read also the comments I've made into the code.
/// <summary>
/// Static key of all the event handlers
/// </summary>
private static readonly object EventClick = new object();
/// <summary>
/// This is the event where event handlers are collected into a
EventHandlerList
/// Page parser parses them from declarative syntax or you add them in
code
/// </summary>
public event EventHandler Submit
{
add
{
Events.AddHandler(EventClick, value);
}
remove
{
Events.RemoveHandler(EventClick, value);
}
}
/// <summary>
/// This method is used to raise Submit event. Do not *confuse* with
aspx's OnSubmit="method_name" syntax
/// </summary>
/// <param name="e"></param>
protected virtual void OnSubmit(EventArgs e)
{
EventHandler handler = Events[EventClick] as EventHandler;
if (handler != null)
handler(this, Error);
}
/// When handling Button's click inside the control, you'd call
this.OnSubmit(EventArgs.Empty);
/// when you want the event to be raised

Signature
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
> Hi all,
>
[quoted text clipped - 27 lines]
>
> Paul
Teemu Keiski - 28 Aug 2006 17:17 GMT
And line
handler(this, Error);
should be
handler(this, e);
Sorry for the typo.
> Hi,
>
[quoted text clipped - 74 lines]
>>
>> Paul
studen771 - 30 Sep 2006 03:03 GMT
> /// When handling Button's click inside the control, you'd call
> this.OnSubmit(EventArgs.Empty);
> /// when you want the event to be raised
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
When you gave the instructions, "when handling Button's click inside the
control," how is this done? where in the control's class do you assign
register its click event?