Page Load Does Not Run

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Heavey

    #1

    Page Load Does Not Run

    Hello, I am walking through the ASP.Net book by Dino Esposito. I created a
    new project and used the "add existing" option to add the files to my new
    project. He had all of the code on a single page and I split into the form
    and codebehind. I place a "break point" on the page load event and run the
    project, but the break point never is hit. The code should display a grid,
    and it shows up in the Design mode, but does not show up when I run. I
    checked the page directive to ensure it was set up with the instruction to
    indicate that I was using the code behind. When I import is as a single page
    and run, it runs just fine. So I must not be setting something correctly to
    cause it to go to the code behind form. What should I be looking for to find
    out why the page load is not running when I run the application?

    Here is my @Page directive..
    <%@ Page Language="vb" AutoEventWireup ="false"
    Codebehind="Gri dInAction2.aspx .vb" Inherits="GridI nAction.GridInA ction2"%>


  • Bret Mulvey [MS]

    #2
    Re: Page Load Does Not Run

    Since you're using AutoEventWireup ="false", Page_Load won't be automatically
    connected up as an event handler for the OnLoad event. Your either need to
    do 1) AutoEventWireup ="true", or 2) override OnLoad instead of using
    Page_Load, or 3) override OnInit and do this.Load += new
    EventHandler(Pa ge_Load);. Personally I almost always choose option 2.
    Visual Studio .NET does option 3 for you.


    "Jim Heavey" <JimHeavey@hotm ail.com> wrote in message
    news:enoU#hFlDH A.1948@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hello, I am walking through the ASP.Net book by Dino Esposito. I created[/color]
    a[color=blue]
    > new project and used the "add existing" option to add the files to my new
    > project. He had all of the code on a single page and I split into the[/color]
    form[color=blue]
    > and codebehind. I place a "break point" on the page load event and run[/color]
    the[color=blue]
    > project, but the break point never is hit. The code should display a[/color]
    grid,[color=blue]
    > and it shows up in the Design mode, but does not show up when I run. I
    > checked the page directive to ensure it was set up with the instruction to
    > indicate that I was using the code behind. When I import is as a single[/color]
    page[color=blue]
    > and run, it runs just fine. So I must not be setting something correctly[/color]
    to[color=blue]
    > cause it to go to the code behind form. What should I be looking for to[/color]
    find[color=blue]
    > out why the page load is not running when I run the application?
    >
    > Here is my @Page directive..
    > <%@ Page Language="vb" AutoEventWireup ="false"
    > Codebehind="Gri dInAction2.aspx .vb" Inherits="GridI nAction.GridInA ction2"%>
    >
    >[/color]


    Comment

    Working...