How to make VS create a page_init (c#)

Discussion in 'ASP .Net' started by SingLu, May 27, 2006.

  1. SingLu

    SingLu Guest

    I'm going nuts here. I'm using VS2005 and C# and would like to create a
    simple page and use the page_init-event. I add a new page but can't find a
    way to make VS add a eventhandler. If I dbl.click the page I get a page_load
    method - but I want to see a list of possible events (including page_init).
    If a select the document and look in the property-window theres no "flash"
    to show me a list of events (like there is where using a control). Its so
    easy in VB - how is it done in c#?

    Thanks
     
    SingLu, May 27, 2006
    #1
    1. Advertising

  2. SingLu

    Chris Jobson Guest

    ..SingLu" <> wrote in message
    news:...
    > I'm going nuts here. I'm using VS2005 and C# and would like to create a
    > simple page and use the page_init-event. I add a new page but can't find a
    > way to make VS add a eventhandler. If I dbl.click the page I get a
    > page_load method - but I want to see a list of possible events (including
    > page_init). If a select the document and look in the property-window
    > theres no "flash" to show me a list of events (like there is where using a
    > control). Its so easy in VB - how is it done in c#?


    It appears that all you have to do is add an appropriately-named method
    (e.g. Page_Init, Page_PreRender, etc.) with the correct signature to the
    code-behind file and it will be automatically invoked. In my case I wanted
    to handle PreRender and I added the method:
    protected void Page_PreRender(object sender, EventArgs e)
    {
    ...
    }
    and it just worked! However, it seems EXTREMELY bizarre to me that there is
    no nice way to get a list of the possible events and to name the handler
    whatever you like.

    Chris Jobson
     
    Chris Jobson, May 28, 2006
    #2
    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. Patrick Kristiansen

    Page_Load or Page_Init

    Patrick Kristiansen, Mar 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    602
    Patrick Kristiansen
    Mar 5, 2004
  2. Guest
    Replies:
    2
    Views:
    574
    Natty Gur
    Jul 13, 2003
  3. Guest
    Replies:
    2
    Views:
    3,131
    Guest
    Jul 16, 2003
  4. Christian

    Page_Init() and Page_Load()

    Christian, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    703
    Cristian Suazo
    Jul 16, 2003
  5. Christian
    Replies:
    0
    Views:
    512
    Christian
    Jul 16, 2003
Loading...

Share This Page