Page inherting from .master - unexpected results

Discussion in 'ASP .Net' started by =?Utf-8?B?QXJ0?=, May 26, 2006.

  1. This simple code works as expected in a regular asp.net 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";
    }
    =?Utf-8?B?QXJ0?=, May 26, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug McCann
    Replies:
    1
    Views:
    993
    William Brogden
    Aug 5, 2004
  2. Frans Englich

    Inherting from object. Or not.

    Frans Englich, Jan 26, 2005, in forum: Python
    Replies:
    7
    Views:
    357
    Nick Coghlan
    Jan 28, 2005
  3. Zeba
    Replies:
    1
    Views:
    480
    Mark Rae
    Feb 22, 2007
  4. ThatsIT.net.au

    Inherting classes

    ThatsIT.net.au, Sep 7, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    345
    ThatsIT.net.au
    Sep 9, 2009
  5. Chuck P

    GridView Inherting

    Chuck P, Jun 25, 2007, in forum: ASP .Net Building Controls
    Replies:
    6
    Views:
    751
    Walter Wang [MSFT]
    Jul 12, 2007
Loading...

Share This Page