Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Master and content

Posted on 2011-09-16
2
Medium Priority
?
381 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
2 Comments
 
LVL 4

Accepted Solution

by:
guramrit earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

810 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