codebehind and page_load event

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
 
E

Eric

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top