N
Neil Chambers
I have a public property defined in my master page
public partial class MainMaster : System.Web.UI.MasterPage
{
string UserName;
public string userName
{
get
{
return UserName;
}
set
{
UserName = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
userName = "MyUser";
}
}
I have set up the MasterType directive on a child page and can locate the
userName property using intellisense - but when the child page loads the
property is no longer set;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Master.userName; // this does not appear
TextBox1.Text += "\nhowdy"; //this does appear
}
}
What am I doing wrong?
Cheers,
n
public partial class MainMaster : System.Web.UI.MasterPage
{
string UserName;
public string userName
{
get
{
return UserName;
}
set
{
UserName = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
userName = "MyUser";
}
}
I have set up the MasterType directive on a child page and can locate the
userName property using intellisense - but when the child page loads the
property is no longer set;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Master.userName; // this does not appear
TextBox1.Text += "\nhowdy"; //this does appear
}
}
What am I doing wrong?
Cheers,
n