Solved

Master and content

Posted on 2011-09-16
2
374 Views
Last Modified: 2012-05-12
Hey Guys i have an master and content page, my menu is on the master page and the binding is done in the master page.

my problem is in the content page load i try finding the menu item and it is zero

so i need a event so fires after the master page loads.

here my content page load


protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Menu menu = (Menu)(this.Master.FindControl("Menu"));
            menu.FindItem("HOME").Selected = true;
        }
    }

Open in new window

0
Comment
Question by:JCWEBHOST
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
guramrit earned 500 total points
ID: 36548447
try using PreRender as follows:
 
protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        Menu menu = (Menu)(this.Master.FindControl("Menu"));
        menu.PreRender += menu_PreRender;
    }
}
void menu_PreRender(object sender, EventArgs e)
{
    var menu = (Menu)sender;
    menu.FindItem("HOME").Selected = true;
}

Open in new window

0
 

Author Closing Comment

by:JCWEBHOST
ID: 36548460
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question