codebehind and page_load event

Discussion in 'ASP .Net' started by Maurice Walmsley, Aug 19, 2003.

  1. 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.EventArgs)
    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
     
    Maurice Walmsley, Aug 19, 2003
    #1
    1. Advertising

  2. Maurice Walmsley

    Eric Guest

    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.EventArgs) Handles MyBase.Load

    Eric


    "Maurice Walmsley" <> wrote in message
    news:...
    > 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.EventArgs)
    > 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, Aug 20, 2003
    #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. bminder
    Replies:
    1
    Views:
    2,212
    nfedin
    Feb 23, 2004
  2. z. f.
    Replies:
    0
    Views:
    589
    z. f.
    Oct 19, 2004
  3. =?Utf-8?B?RXJpayBKZW5zZW4=?=

    CodeBehind But Not Postback - Page_Load fires twice

    =?Utf-8?B?RXJpayBKZW5zZW4=?=, Jul 19, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,379
    =?Utf-8?B?RXJpayBKZW5zZW4=?=
    Jul 21, 2005
  4. Replies:
    3
    Views:
    602
    Terry Burns
    Feb 3, 2006
  5. rockdale
    Replies:
    1
    Views:
    692
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
Loading...

Share This Page