Page inherting from .master - unexpected results


G

Guest

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";
}
 
Ad

Advertisements


Top