470,648 Members | 1,547 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

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.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
Nov 17 '05 #1
1 1391
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" <mb********@hotmail.com> wrote in message
news:92**************************@posting.google.c om...
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Maurice Walmsley | last post: by
3 posts views Thread by nevets2001uk | last post: by
12 posts views Thread by Karl Hungus | last post: by
6 posts views Thread by Thomas Andersson | last post: by
2 posts views Thread by landers | last post: by
1 post views Thread by Randall Parker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.