event handling in asp.net

Discussion in 'ASP .Net' started by Mike Gaab, Apr 1, 2006.

  1. Mike Gaab

    Mike Gaab Guest

    I am having two problems:

    1. Determing the signature of event handlers for any control that raises
    events. I have a handle on the arguments but the method name is not clear.

    2. What is the relationship between event properties and public methods
    listed in the VS class browser. An example will help describe this one.

    For example, the DataGrid has a event property named EditCommand, what is
    the signature of the event handler for the event?

    The DataGrid also exposes a public method called OnEditCommand(...),
    is this method associated to the EditCommand?

    In the meantime, I'll create an example and maybe answer my question.

    Mike



    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
     
    Mike Gaab, Apr 1, 2006
    #1
    1. Advertising

  2. Re: event handling in asp.net

    The public methods associated with control events allow you to manually
    raise the event. When you call that method and pass a
    DataGridCommandEventArgs, the control will in turn call any event
    handlers, passing itself and that same EventArgs instance. You might
    want to do this from a custom control, for example - you could have a
    custom control inside a datagrid and in the handler for its onclick
    method, raise the onEditCommand event of the containing grid.

    The signature for the event is void (object, DataGridCommandEventArgs)

    There isn't always a quick and easy way of working put what the
    signature of an event handler should be - I personally use Google, or a
    FireFox bookmarklet.
     
    Flinky Wisty Pomm, Apr 1, 2006
    #2
    1. Advertising

  3. Mike Gaab

    Mike Gaab Guest

    Re: event handling in asp.net

    "Flinky Wisty Pomm" <> wrote in message
    news:...
    > The public methods associated with control events allow you to manually
    > raise the event. When you call that method and pass a
    > DataGridCommandEventArgs, the control will in turn call any event
    > handlers, passing itself and that same EventArgs instance. You might
    > want to do this from a custom control, for example - you could have a
    > custom control inside a datagrid and in the handler for its onclick
    > method, raise the onEditCommand event of the containing grid.
    >
    > The signature for the event is void (object, DataGridCommandEventArgs)
    >
    > There isn't always a quick and easy way of working put what the
    > signature of an event handler should be - I personally use Google, or a
    > FireFox bookmarklet.
    >


    The methods that are associated with control events are protected, not
    public. So if I subclass DataGrid I should have access to those methods but
    I don't? I am from the Java world so this is not making sense that I can't
    see the control event methods from the subclass. I probably have to
    declare/define them in the subclass. Could easily be missing something but
    can't see what that is right now. Hmmmm...

    Mike



    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
     
    Mike Gaab, Apr 1, 2006
    #3
  4. Re: event handling in asp.net

    Sorry, my bad they are protected, yes - you can't access them from the
    subclass? That's odd. Ignore my ravings about handling them earlier. Up
    all night.

    You should be able to call them from a derived class, or override them
    - if you override an event method, make sure that you call
    base.OnWhateverEvent. Can you post some code?
     
    Flinky Wisty Pomm, Apr 1, 2006
    #4
  5. Mike Gaab

    Mike Gaab Guest

    Re: event handling in asp.net

    "Flinky Wisty Pomm" <> wrote in message
    news:...
    > Sorry, my bad they are protected, yes - you can't access them from the
    > subclass? That's odd. Ignore my ravings about handling them earlier. Up
    > all night.
    >
    > You should be able to call them from a derived class, or override them
    > - if you override an event method, make sure that you call
    > base.OnWhateverEvent. Can you post some code?
    >


    Hey - no problem.
    No example code.

    Get some sleep. :)

    Mike



    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
     
    Mike Gaab, Apr 2, 2006
    #5
    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. Makarand

    ASP.NET Event handling.

    Makarand, Jul 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    414
    Makarand
    Jul 24, 2003
  2. Rodney
    Replies:
    1
    Views:
    566
    Arsen V.
    Sep 7, 2006
  3. Replies:
    0
    Views:
    499
  4. Frank
    Replies:
    2
    Views:
    421
    Victor Garcia Aprea [MVP]
    Nov 26, 2003
  5. David Norris

    ASP.NET Event handling

    David Norris, Feb 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    146
    Teemu Keiski
    Feb 22, 2005
Loading...

Share This Page