Exposing an event handler as a control property

Discussion in 'ASP .Net Web Controls' started by paul.hester@gmail.com, Aug 28, 2006.

  1. Guest

    Hi all,

    I have a custom server control that can contain one or more buttons.
    I'm trying to expose an event handler as a property so that the buttons
    can fire a click event when clicked. However, I'm getting the following
    error:

    Cannot create an object of type 'System.EventHandler' from its string
    representation 'OnSubmit' for the 'OnSubmit' property.

    My control's tag looks like this:

    <stuff:MyControl OnSubmit="OnSubmit" Width="430"
    runat="server">...</stuff:MyControl>

    The property looks like this:

    public EventHandler OnSubmit
    {
    get { return _onSubmit; }
    set { _onSubmit = value; }
    }

    I've tried the property with and without a type converter without
    success.

    Any help would be much appreciated.

    Thanks,

    Paul
     
    , Aug 28, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    Exposing event in user control

    Mark, Jul 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    431
    John Saunders
    Jul 2, 2004
  2. Paul
    Replies:
    1
    Views:
    430
  3. Replies:
    1
    Views:
    727
    Damien
    Feb 22, 2007
  4. Deep S.

    Exposing Font Name Property for Custom Control

    Deep S., Aug 4, 2003, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    188
    Deep S.
    Aug 4, 2003
  5. Exposing an event handler as a control property

    , Aug 28, 2006, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    174
    studen771
    Sep 30, 2006
Loading...

Share This Page