locked
Dumb question! RRS feed

  • Question

  • User-1746965433 posted

    Hi guys & gals... looking for a bit of help.

    First of all, im an asp.net nub (come from a classic asp background) and im banging my head with the following problem. Basicly im using a setup of nested master pages like so.

    DefaultMaster (controls the main layout of the site)

    2columnMaster (controls the sub-layout of the site - a 2 column page for content and links back to the default master)

    Default.aspx (this has the 2column master linked in it and has 2 content areas to display data)

    Now first of all, the site looks and displays fine, so the nested masters are doing what they are supposed to.

    Now... default.aspx has a code behind (VB) that has a simple "hello world" on it, that is supposed to update a label that is stored in one of the content areas in the default.aspx page.

    Default.aspx contains:

    <asp:Content ID="Content1" ContentPlaceHolderID="MainColumn" Runat="Server">
    <h2>test</h2>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </asp:Content>
     
    Default.aspx.vb contains: 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Label1.Text = "hello world"
    End Sub
     

    The trouble is, the code just wont run. The page loads, looks great but the label wont get updated. Ive tried using the page load event and firing it with a button but neither update the label.

    Any ideas? Come on... what stupid nub mistake am i making, lol!

    Thursday, March 5, 2009 9:58 AM

Answers

  • User-206222649 posted

    DOH!! I see the problem, sorry not enough coffe yet this morning:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

    notice the Handles Me.Load at the end.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2009 11:17 AM

All replies

  • User-206222649 posted

    That all sounds fine to me, that should work so something is missing here.

    if you set a break point in the page_load does it actually hit it?

     

    Thursday, March 5, 2009 10:43 AM
  • User-1746965433 posted

     *googles how to put a break point in*

    Thursday, March 5, 2009 10:50 AM
  • User-1746965433 posted

     Ok, assuming i did it correctly... i cant see anywhere that is throwing output to the screen so im gonna guess and say no, it doesnt halt at the breakpoint.

     

    EDIT: ok, i managed to get the button version working, so if i click the button it will update teh label. That will also hault on the breakpoint... but the page load version wont do either ... very strange.

    Thursday, March 5, 2009 10:56 AM
  • User-206222649 posted

    DOH!! I see the problem, sorry not enough coffe yet this morning:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

    notice the Handles Me.Load at the end.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2009 11:17 AM
  • User-1746965433 posted

    You sir, are a star!

    Have a coffee on me :)

    Thursday, March 5, 2009 11:31 AM