J
j-in-uk
I have 3 pages Site.master, Album.aspx and ContinentsMenu.ascx.
Continents is a usercontrol placed in Albums. In Album.aspx.cs I need
to access a property from the Continents usercontrol and is done using
the code below. When I add masterpages to Album.aspx and remove all the
html tags I get the error System.NullReferenceException: Object
reference not set to an instance of an object.in the line marked ******
below. I notice once I insert the following line back<!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> back to the Album.aspx
page and remove the masterpage references it works fine. Any ideas on
how i can access my usercontrol using masterpages?
private ContinentsMenu _continentList;
override protected void OnInit(System.EventArgs e)
{base.OnInit(e);
InitializeComponent();
_continentList = ((ContinentsMenu)(FindControl("ContinentsMenu1")));
}
protected void Page_Load(object sender, System.EventArgs e)
******{_albumPath = Path.Combine(_photosPath,
_continentList.SelectedContinent);}
Continents is a usercontrol placed in Albums. In Album.aspx.cs I need
to access a property from the Continents usercontrol and is done using
the code below. When I add masterpages to Album.aspx and remove all the
html tags I get the error System.NullReferenceException: Object
reference not set to an instance of an object.in the line marked ******
below. I notice once I insert the following line back<!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> back to the Album.aspx
page and remove the masterpage references it works fine. Any ideas on
how i can access my usercontrol using masterpages?
private ContinentsMenu _continentList;
override protected void OnInit(System.EventArgs e)
{base.OnInit(e);
InitializeComponent();
_continentList = ((ContinentsMenu)(FindControl("ContinentsMenu1")));
}
protected void Page_Load(object sender, System.EventArgs e)
******{_albumPath = Path.Combine(_photosPath,
_continentList.SelectedContinent);}