Solved

ASP.NET Navigation and Validation quesitons

Posted on 2012-03-31
1
169 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

18 Experts available now in Live!

Get 1:1 Help Now