Solved

Master and content

Posted on 2011-09-16
2
367 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 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now