codebehind and page_load event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maurice Walmsley

    #1

    codebehind and page_load event

    hello and thanks

    I am as green as mold when it comes to asp.net, so please bear with
    me.

    I am trying to get an asp.net page with a webform to work using
    codebehind. My class/routines work fine, just doing simple stuff like
    changing the text of lables.

    I cant seem to get this to work though;

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArg s)
    Label8.Text = "pre ELSEIF"
    If IsPostBack Then
    Label8.Text = "is postback"
    Else
    Label8.Text = "is NOT postback"
    End If
    Label8.Text = "post ELSEIF"
    End Sub

    any ideas why the page_load event doesnt fire, or if it does, why
    label8 doesnt change?

    thanks

    maurice
  • Eric

    #2
    Re: codebehind and page_load event

    Unless you're using auto-event wireup, add a "Handles MyBase.Load" at the
    end of the the Page_Load line:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    Eric


    "Maurice Walmsley" <mbwalmsley@hot mail.com> wrote in message
    news:922b3604.0 308181902.788d3 a86@posting.goo gle.com...[color=blue]
    > hello and thanks
    >
    > I am as green as mold when it comes to asp.net, so please bear with
    > me.
    >
    > I am trying to get an asp.net page with a webform to work using
    > codebehind. My class/routines work fine, just doing simple stuff like
    > changing the text of lables.
    >
    > I cant seem to get this to work though;
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArg s)
    > Label8.Text = "pre ELSEIF"
    > If IsPostBack Then
    > Label8.Text = "is postback"
    > Else
    > Label8.Text = "is NOT postback"
    > End If
    > Label8.Text = "post ELSEIF"
    > End Sub
    >
    > any ideas why the page_load event doesnt fire, or if it does, why
    > label8 doesnt change?
    >
    > thanks
    >
    > maurice[/color]


    Comment

    Working...