codebehind and page_load event

  • Thread starter Thread starter Maurice Walmsley
  • Start date Start date
M

Maurice Walmsley

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
 
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
 
Back
Top