Page inherting from .master - unexpected results

Discussion in 'ASP .Net' started by Guest, May 26, 2006.

  1. Guest

    Guest Guest

    This simple code works as expected in a regular page but doesn't when
    the same content is run from a page which inherited from a .master template.
    I literally copied the Button and the two Label server controls (along w/ the
    code) from one page to another.

    In the first case Label1.Text is set in the LOAD event and stays that way
    throughout subsequest postbacks BUT goes back to its defalut value (just
    "Label", which was set in a designer) when executed from a page inheriting
    from .master.
    Can anyone point me in the right direction?

    protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)
    Label1.Text = DateTime.Now.ToString();

    protected void Button1_Click(object sender, EventArgs e)
    Label2.Text = "Test";
    Guest, May 26, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.