Advertisement

09.02.2008 at 05:50PM PDT, ID: 23697952
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Trouble with Nested Master Pages.

Asked by P1ST0LPETE in Programming for ASP.NET, Cascading Style Sheets (CSS), .NET

Tags:

Experts-

This doesn't seem like it will be too complicated, but it may be complicated to explain :-).  I think the root of the problem revolves around my misuse of "Master.FindControl" in combination with nested master pages.  Obviously I could be wrong.  Anyway, here it is:

My site setup looks like the following:
-Masterpage(main masterpage - contains navbar with links 1-6)
        -page1 (content to main masterpage - is displayed when link 1 is clicked)
        -page2 (content to main masterpage - is displayed when link 2 is clicked)
        -Nested Masterpage (content to main masterpage - contains navbar with links A-D)
                -page3/A (content to nested masterpage - is displayed when link 3 is click and should display when link A is clicked)
                -pageB (content to nested masterpage - should display when link B is clicked)
                -pageC (content to nested masterpage - should display when link C is clicked)
                -pageD (content to nested masterpage - should display when link D is clicked)
        -page4(content to main masterpage - is displayed when link 4 is clicked)
        -page5 (content to main masterpage - is displayed when link 5 is clicked)
        -page6 (content to main masterpage - is displayed when link 6 is clicked)

(Problem #1)
On my navbar on my main master page I have 6 <asp:LinkButton>'s, styled with CSS so that they have an image for their background (image#1), and another image on mouse hover (image#2).  When a content page is displayed, I am programatically changing the css class of the linkbutton that is assigned to the content page.  So for example, link 5 is clicked, and on the pageload of page 5, link5 on the masterpage has it's css class changed to a different class so that the image is different, making that link appear "active".  
I am using the following code on each content page to make this happen: Code Snippet #1 shown below.
This is working correctly for content pages 1-2 and 4-6.   This is not working correctly for content page 3/A, I'm assuming because the code can't determine which master page to look to for the control.

===============================================

(Problem #2)
On my navbar on my nested master page I have 4 <asp:linkbutton>'s (links A-D) using the same setup as mentioned above.  I have all my linkbuttons on my main master page set to use the same event handler, and all my linkbuttons on my nested master page set to use the same event handler.  I am using the following code example to make this happen: Code Snippet #2 shown below.  This is working fine for links 1-6 on the main masterpage.  However links A-D on the nested masterpage are not working.  An error is not being thrown, but when links A-D are clicked they opt out of the IF statement with the "else" option and direct back to my index page.  Pages A-D do load properly if I manually type their address into the URL, however the CSS class isn't changing as it should.

Thanks for the help.  Let me know if I can clarify anything.

-Pete

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
/*=== Code Snippet #1 ===*/
protected void Page_Load(object sender, EventArgs e)
{
    LinkButton btHome = (LinkButton)Master.FindControl("linkEmail");
    btHome.CssClass = "navButtonActive";
}
 
 
/*=== Code Snippet #2 ===*/
protected void EmailNavigation(object sender, EventArgs e)
{
    string userClickedMe = Request["__EVENTTARGET"];
 
    string EMAIL = "ctl00$linkNewEmail",
           SCHEDULED = "ctl00$linkScheduled",
           LETTER = "ctl00$linkNewLetter",
           LIBRARY = "ctl00$linkLibrary";
 
    if (userClickedMe == EMAIL)
    {
        Response.Redirect("http://xxx.xxx.xxx.xxx/admin/NewEmail.aspx");
    }
    else if (userClickedMe == SCHEDULED)
    {
        Response.Redirect("http://xxx.xxx.xxx.xxx/admin/Scheduled.aspx");
    }
    else if (userClickedMe == LETTER)
    {
        Response.Redirect("http://xxx.xxx.xxx.xxx/admin/NewLetter.aspx");
    }
    else if (userClickedMe == LIBRARY)
    {
        Response.Redirect("http://xxx.xxx.xxx.xxx/admin/Library.aspx");
    }
    else
    {
            Response.Redirect("http://xxx.xxx.xxx.xxx/admin");
    }
}
[+][-]09.02.2008 at 06:08PM PDT, ID: 22373176

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, Cascading Style Sheets (CSS), .NET
Tags: ASP.NET C#
Sign Up Now!
Solution Provided By: Solar_Flare
Participating Experts: 2
Solution Grade: C
 
 
[+][-]09.02.2008 at 06:45PM PDT, ID: 22373408

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.02.2008 at 06:49PM PDT, ID: 22373429

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.02.2008 at 08:54PM PDT, ID: 22374033

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.03.2008 at 12:10AM PDT, ID: 22374707

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.03.2008 at 08:26AM PDT, ID: 22378287

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 06:11AM PDT, ID: 22386804

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.16.2008 at 10:10AM PDT, ID: 22490701

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628