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

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top