Page Events

Discussion in 'ASP .Net' started by Scott M., Jan 16, 2008.

  1. Scott M.

    Scott M. Guest

    In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of
    the page (web form) events (i.e. new, init, loadviewstate, load,
    saveviewstate, etc.) and set up event handlers for them?
     
    Scott M., Jan 16, 2008
    #1
    1. Advertising

  2. Scott M.

    Leon Mayne Guest

    "Scott M." <> wrote in message
    news:...
    > In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
    > of the page (web form) events (i.e. new, init, loadviewstate, load,
    > saveviewstate, etc.) and set up event handlers for them?


    In the code behind file, select "(FormName) Events" in the dropdown in the
    top right, and all the form's events will be listed in the dropdown to the
    right.
     
    Leon Mayne, Jan 16, 2008
    #2
    1. Advertising

  3. "Scott M." <> wrote in message
    news:...

    > In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
    > of the page (web form) events (i.e. new, init, loadviewstate, load,
    > saveviewstate, etc.) and set up event handlers for them?


    Not quite sure what you mean about "seeing" the events...?

    As for setting up event handlers for them, just start typing...

    E.g. if you want a Page_Init event, just type the following into your
    code-behind:

    protected void Page_Init(object sender, System.EventArgs e)
    {

    }

    and add some code...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Jan 16, 2008
    #3
  4. Scott M.

    Leon Mayne Guest

    "Leon Mayne" <leon@rmv_me.mvps.org> wrote in message
    news:...
    > "Scott M." <> wrote in message
    > news:...
    >> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
    >> of the page (web form) events (i.e. new, init, loadviewstate, load,
    >> saveviewstate, etc.) and set up event handlers for them?

    >
    > In the code behind file, select "(FormName) Events" in the dropdown in the
    > top right, and all the form's events will be listed in the dropdown to the
    > right.


    Looking at your other post, I see that you're using C#, not VB.NET. In that
    case the above method won't work. Not sure in C#. You could look at the
    object's events in the class viewer?
     
    Leon Mayne, Jan 16, 2008
    #4
  5. Scott M.

    Leon Mayne Guest

    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Scott M." <> wrote in message
    > news:...
    >
    >> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
    >> of the page (web form) events (i.e. new, init, loadviewstate, load,
    >> saveviewstate, etc.) and set up event handlers for them?

    >
    > Not quite sure what you mean about "seeing" the events...?
    >
    > As for setting up event handlers for them, just start typing...
    >
    > E.g. if you want a Page_Init event, just type the following into your
    > code-behind:
    >
    > protected void Page_Init(object sender, System.EventArgs e)
    > {
    >
    > }
    >
    > and add some code...


    I think the OP would like to see a list of events availble for an object,
    e.g. if you didn't know that the Page_Init event existed then you'd have
    trouble using it! In VB you can get a list of the object's events and when
    you select one it will automatically create the handler for you. I can't see
    similar functionality in C#. Do you know how to do this, as I'm also
    interested!
     
    Leon Mayne, Jan 16, 2008
    #5
  6. Scott M.

    grava Guest


    >
    > Looking at your other post, I see that you're using C#, not VB.NET. In
    > that case the above method won't work. Not sure in C#. You could look at
    > the object's events in the class viewer?


    Just a question about this difference ... is there any reason there isn't an
    "event explorer" in c# as we've got in vb.net ??

    Thanks in advance.


    --
    Gianluca Gravina
    http://blogs.ugidotnet.org/thinkingingrava
     
    grava, Jan 16, 2008
    #6
  7. With your page open in the IDE, select "Page" from the leftmost dropdown
    above the code...and then select the available events from the dropdown to its right.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en espaƱol : http://asp.net.do/foros/
    ======================================
    "Scott M." <> wrote in message news:...
    > In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of the page (web form) events (i.e. new,
    > init, loadviewstate, load, saveviewstate, etc.) and set up event handlers for them?
    >
     
    Juan T. Llibre, Jan 16, 2008
    #7
  8. Scott M.

    grava Guest

    >
    > I think the OP would like to see a list of events availble for an object,
    > e.g. if you didn't know that the Page_Init event existed then you'd have
    > trouble using it! In VB you can get a list of the object's events and when
    > you select one it will automatically create the handler for you. I can't
    > see similar functionality in C#. Do you know how to do this, as I'm also
    > interested!


    Well, by default starting writing "this." and let the intellisense show up,
    then you can search for events (you've got an icon that it's quite
    self-explanatory). By default if you've got an event like "PreInit", with
    autoEventWireUp you can write the code Page_PreInit, if the attribute is set
    to false you have to override the method that will raise the event:

    override OnPreInit()
    {
    base.OnPreInit();
    // my code
    }


    --
    Gianluca Gravina
    http://blogs.ugidotnet.org/thinkingingrava
     
    grava, Jan 16, 2008
    #8
  9. Scott M.

    Scott M. Guest

    Yes, that's exactly the problem and what I'm after Leon!




    "Leon Mayne" <leon@rmv_me.mvps.org> wrote in message
    news:...
    > "Mark Rae [MVP]" <> wrote in message
    > news:...
    >> "Scott M." <> wrote in message
    >> news:...
    >>
    >>> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a
    >>> list of the page (web form) events (i.e. new, init, loadviewstate, load,
    >>> saveviewstate, etc.) and set up event handlers for them?

    >>
    >> Not quite sure what you mean about "seeing" the events...?
    >>
    >> As for setting up event handlers for them, just start typing...
    >>
    >> E.g. if you want a Page_Init event, just type the following into your
    >> code-behind:
    >>
    >> protected void Page_Init(object sender, System.EventArgs e)
    >> {
    >>
    >> }
    >>
    >> and add some code...

    >
    > I think the OP would like to see a list of events availble for an object,
    > e.g. if you didn't know that the Page_Init event existed then you'd have
    > trouble using it! In VB you can get a list of the object's events and when
    > you select one it will automatically create the handler for you. I can't
    > see similar functionality in C#. Do you know how to do this, as I'm also
    > interested!
     
    Scott M., Jan 16, 2008
    #9
  10. Scott M.

    Scott M. Guest

    If I type "this" in a page class, nothing happens. The only way I could do
    that would be to go into an existing code block and type "this" to see the
    intellisense dropdown. Then, I'd have to just know what is an event or an
    overrideable event handler (which I can do). But, I was hoping for
    something easier as in VB .NET, where you just select the top-left drop-down
    in the code editor and then the top-right dropdown gives you the events for
    the item in the left drop-down.

    :(


    "grava" <> wrote in message
    news:...
    > >
    >> I think the OP would like to see a list of events availble for an object,
    >> e.g. if you didn't know that the Page_Init event existed then you'd have
    >> trouble using it! In VB you can get a list of the object's events and
    >> when you select one it will automatically create the handler for you. I
    >> can't see similar functionality in C#. Do you know how to do this, as I'm
    >> also interested!

    >
    > Well, by default starting writing "this." and let the intellisense show
    > up, then you can search for events (you've got an icon that it's quite
    > self-explanatory). By default if you've got an event like "PreInit", with
    > autoEventWireUp you can write the code Page_PreInit, if the attribute is
    > set to false you have to override the method that will raise the event:
    >
    > override OnPreInit()
    > {
    > base.OnPreInit();
    > // my code
    > }
    >
    >
    > --
    > Gianluca Gravina
    > http://blogs.ugidotnet.org/thinkingingrava
    >
    >
    >
     
    Scott M., Jan 16, 2008
    #10
  11. Hi Scott,

    Yes, for the C# asp.net designer, the page level events list does be an
    existing limitation(as VB.NET IDE are developed separately from C# one). I
    really suggest you to submit your comments on this to our product feedback
    site:

    http://connect.microsoft.com/feedback/default.aspx?SiteID=210

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >From: "Scott M." <>
    >References: <>

    <>
    <>
    <>
    >Subject: Re: Page Events
    >Date: Wed, 16 Jan 2008 13:39:35 -0500
    >
    >If I type "this" in a page class, nothing happens. The only way I could

    do
    >that would be to go into an existing code block and type "this" to see the
    >intellisense dropdown. Then, I'd have to just know what is an event or an
    >overrideable event handler (which I can do). But, I was hoping for
    >something easier as in VB .NET, where you just select the top-left

    drop-down
    >in the code editor and then the top-right dropdown gives you the events

    for
    >the item in the left drop-down.
    >
    :mad:
    >
    >
    >"grava" <> wrote in message
    >news:...
    >> >
    >>> I think the OP would like to see a list of events availble for an

    object,
    >>> e.g. if you didn't know that the Page_Init event existed then you'd

    have
    >>> trouble using it! In VB you can get a list of the object's events and
    >>> when you select one it will automatically create the handler for you. I
    >>> can't see similar functionality in C#. Do you know how to do this, as

    I'm
    >>> also interested!

    >>
    >> Well, by default starting writing "this." and let the intellisense show
    >> up, then you can search for events (you've got an icon that it's quite
    >> self-explanatory). By default if you've got an event like "PreInit",

    with
    >> autoEventWireUp you can write the code Page_PreInit, if the attribute is
    >> set to false you have to override the method that will raise the event:
    >>
    >> override OnPreInit()
    >> {
    >> base.OnPreInit();
    >> // my code
    >> }
    >>
    >>
    >> --
    >> Gianluca Gravina
    >> http://blogs.ugidotnet.org/thinkingingrava
    >>
    >>
    >>

    >
    >
    >
     
    Steven Cheng[MSFT], Jan 17, 2008
    #11
  12. Scott M.

    Scott M. Guest

    Thanks Steven, I'll do that.


    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hi Scott,
    >
    > Yes, for the C# asp.net designer, the page level events list does be an
    > existing limitation(as VB.NET IDE are developed separately from C# one). I
    > really suggest you to submit your comments on this to our product feedback
    > site:
    >
    > http://connect.microsoft.com/feedback/default.aspx?SiteID=210
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    > --------------------
    >>From: "Scott M." <>
    >>References: <>

    > <>
    > <>
    > <>
    >>Subject: Re: Page Events
    >>Date: Wed, 16 Jan 2008 13:39:35 -0500
    >>
    >>If I type "this" in a page class, nothing happens. The only way I could

    > do
    >>that would be to go into an existing code block and type "this" to see the
    >>intellisense dropdown. Then, I'd have to just know what is an event or an
    >>overrideable event handler (which I can do). But, I was hoping for
    >>something easier as in VB .NET, where you just select the top-left

    > drop-down
    >>in the code editor and then the top-right dropdown gives you the events

    > for
    >>the item in the left drop-down.
    >>
    >:mad:
    >>
    >>
    >>"grava" <> wrote in message
    >>news:...
    >>> >
    >>>> I think the OP would like to see a list of events availble for an

    > object,
    >>>> e.g. if you didn't know that the Page_Init event existed then you'd

    > have
    >>>> trouble using it! In VB you can get a list of the object's events and
    >>>> when you select one it will automatically create the handler for you. I
    >>>> can't see similar functionality in C#. Do you know how to do this, as

    > I'm
    >>>> also interested!
    >>>
    >>> Well, by default starting writing "this." and let the intellisense show
    >>> up, then you can search for events (you've got an icon that it's quite
    >>> self-explanatory). By default if you've got an event like "PreInit",

    > with
    >>> autoEventWireUp you can write the code Page_PreInit, if the attribute is
    >>> set to false you have to override the method that will raise the event:
    >>>
    >>> override OnPreInit()
    >>> {
    >>> base.OnPreInit();
    >>> // my code
    >>> }
    >>>
    >>>
    >>> --
    >>> Gianluca Gravina
    >>> http://blogs.ugidotnet.org/thinkingingrava
    >>>
    >>>
    >>>

    >>
    >>
    >>

    >
     
    Scott M., Jan 17, 2008
    #12
  13. Scott M.

    Leon Mayne Guest

    "Juan T. Llibre" <> wrote in message
    news:...
    > With your page open in the IDE, select "Page" from the leftmost dropdown
    > above the code...and then select the available events from the dropdown to
    > its right.


    Sadly doesn't work in a C# ASP.NET project :-(

    Scott: When you do add the enhancement request on connect, please post the
    feedback Id on this thread so we can vote for it.
     
    Leon Mayne, Jan 17, 2008
    #13
  14. Scott M.

    Scott M. Guest

    The Feedback ID is: 322994.

    I've also posted this as a new thread in both the C# and the ASP .NET NG's
    to hopefully attract more attention.

    -Scott




    "Leon Mayne" <leon@rmv_me.mvps.org> wrote in message
    news:...
    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> With your page open in the IDE, select "Page" from the leftmost dropdown
    >> above the code...and then select the available events from the dropdown
    >> to its right.

    >
    > Sadly doesn't work in a C# ASP.NET project :-(
    >
    > Scott: When you do add the enhancement request on connect, please post the
    > feedback Id on this thread so we can vote for it.
     
    Scott M., Jan 18, 2008
    #14
    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. shiv
    Replies:
    0
    Views:
    479
  2. Alvin Bruney
    Replies:
    1
    Views:
    727
  3. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    order of events - dynamic checkbox events

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    566
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Aug 17, 2005
  4. newbye
    Replies:
    0
    Views:
    582
    newbye
    Jul 6, 2006
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    372
    Chris
    Aug 30, 2005
Loading...

Share This Page