Solved

ASP.NET Navigation and Validation quesitons

Posted on 2012-03-31
1
176 Views
Last Modified: 2012-04-03
Two things I am trying to figure out.

Question 1.
A site map comes from the master page.  The site map is displayed in a tree view.  How can I disable the tree view until there are no more pages errors.

Question 2.
Both the current and prior page use  MasterPageFile="~/Site.Master"
And
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"

Page 1 has a control named TextBox1.

Why does this PageLoad() code never find control TextBox1?
{
   ContentPlaceHolder cp = ((ContentPlaceHolder)PreviousPage.Master.FindControl("ContentPlaceHolder1"));
           string fname = ((TextBox)cp.FindControl("TextBox1")).Text;
           valuesFromPriorPage.Text = fname;
}


Thanks
0
Comment
Question by:wilfordrocks
1 Comment
 
LVL 11

Accepted Solution

by:
madgino earned 500 total points
ID: 37795457
Q1: It's not clear what are you trying to achieve, but I'll try a response:
 - change in code visible =false for tree and change it back when the page is free of errors or
- add  Page_Error event in page and hide the tree if there is any error
http://msdn.microsoft.com/en-us/library/ed577840.aspx
- use try/catch for the code that raises error and manage tree visibility in catch code

Q2: You are probably searching the wrong container:
- try to find control recursive
http://sharpertutorials.com/recursive-findcontrol/
- check if indeed you need to search PreviousPage or directly the Master of the current page:
 ContentPlaceHolder cp = ((ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"));
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 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