R
rockdale
Hi,
I have a masterpage and on the page_load event I Populate my mainmenu
from database.
I the page_load event of my content, I am trying to programmly select
the menuitem that represent current content page, but as you know, the
page_load event is fired backward, the content page_load fires first
then followed by the master page page_load, I could not get the
mainmenu in the content page( have not been initialized since
masterpage's page_load have not been fired).
Is there a way to workaround? e.g. put the programmly select menuitem
into another event instead in page_load?
attached is my pseudocode:
MasterPages
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
PopulateMainMenu();
}
}
Content Page
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Menu mMain = (Menu)this.Master.FindControl("menuMain");
mMain.Items[0].Selected = true;
}
}
Thanks a lot
-rockdale
I have a masterpage and on the page_load event I Populate my mainmenu
from database.
I the page_load event of my content, I am trying to programmly select
the menuitem that represent current content page, but as you know, the
page_load event is fired backward, the content page_load fires first
then followed by the master page page_load, I could not get the
mainmenu in the content page( have not been initialized since
masterpage's page_load have not been fired).
Is there a way to workaround? e.g. put the programmly select menuitem
into another event instead in page_load?
attached is my pseudocode:
MasterPages
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
PopulateMainMenu();
}
}
Content Page
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Menu mMain = (Menu)this.Master.FindControl("menuMain");
mMain.Items[0].Selected = true;
}
}
Thanks a lot
-rockdale