CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/16/2007 10:27:35 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 15 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
RaptoR
Asp.Net User
Accessing a contentpage control from a masterpage4/16/2007 10:27:35 AM

0/0

Hello, im trying to access a control in a contentage if there is one but i can't find the right property to get it.

I have the following code,

Literal subHeadline = Page.FindControl( "SubHeadline" ) as Literal;
if ( subHeadline != null )
{
	subHeadline.Text = string.Format( "{0} (Page 2)", mainHeadline.Text );
	mainHeadline.Text = string.Format( "{0} (Page 1)", mainHeadline.Text );
}
But the conrol is always null, how can i get the contol?
Adam.Kahtava
Asp.Net User
Re: Accessing a contentpage control from a masterpage4/16/2007 12:25:07 PM

0/0

Here are a couple links and excerpts that may help you out,  

"At run time, the master page is merged with the content page, so the controls on the master page are accessible to content page code. (If the master page contains controls in a ContentPlaceHolder control, those controls are not accessible if overridden by a Content control from the content page.) The controls are not directly accessible as master-page members because they are protected. However, you can use the FindControl method to locate specific controls on the master page. If the control that you want to access is inside a ContentPlaceHolder control on the master page, you must first get a reference to the ContentPlaceHolder control, and then call its FindControl method to get a reference to the control." - Working with ASP.NET Master Pages Programmatically

This tutorial may be of interest: Creating a Common Toolbar in ASP.NET 2.0 using MasterPage, Delegate and Events


-Adam Kahtava [http://adam.kahtava.com]
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008

Web:
Accessing a contentpage control from a masterpage - ASP.NET Forums Accessing a contentpage control from a masterpage. Last post 04-16-2007 8:25 AM by Adam.Kahtava. 1 replies. Sort Posts: ...
ASP.NET Library - Articles - Access Master Page controls from the ... Access Master Page controls from the Content Page. Summary: An example of how you can get or set the values of a control on the Master Page from one of your ...
Accessing Master Page controls from Content Page user control ... Accessing Master Page controls from Content Page user control ASP.NET.
Access Controls Contained in a MasterPage through a Content Page ... Access Controls Contained in a MasterPage through a Content Page .... Do you in fact have a label control on your masterpage whose ID is "MyLabel"? ...
Access Master Page Control at Content Page Hi All, At My Master Page , I have TreeView control and I am binding this treeview from one of ....
p2p.wrox.com Forums - Access Master page control from Content page. NET 2.0 Beginner > Access Master page control from Content page. ... How can I access controls of Master Page from Content Page? ...
Accessing user control in master page from any content page Accessing user control in master page from any content page. ... I have a user control named header.ascx in a master page. ...
Less Than Dot - Wiki - ASP.NET: Access Master Page controls from ... NET: Access Master Page controls from the Content Page ... how you can get or set the values of a control on the Master Page from one of your content pages. ...
DevToolShed: Access Master Page properties from the content page Many times you need to access a control in your master page from the content page (like setting a page title or adding specific META tags). ...
Master page/content page asp control ID's - .NET ASP Master page/content page asp control ID's. Get answers to your questions in ... must ask the control on the server by accessing the Control. ...




Search This Site:










document management

variables declared/assigned in codebehind page not recognised in design page

a basic question about object creation resulting from a cast

reader closed

simple c# web application create table sql 2000 db

help~ nothing logged by "health monitoring" module!

asp.net scanner device interaction not working in client system place

how to know the unique information about the clinet computer?

codebehind chapter 6 (unleashed) 6.12 could not load type 'mycodebehind'.

problem with using datareader

cast error

compile to reflect changes?

how can i restore my data members declare and used in the page during postback?

db grid to text

problem with 0 value

input string was not in a correct format. plz help

trace the times of file being download

creating xml document

a web application with questions.

populating a control with html file contents, images included?

recently viewed pages list

templating

file upload management system

basic forms help

no responding/returning value

textbox and other buttons alignment in the default web page

datatable efficiency

alternate row color in table control

"

dll error how to fix it?

  Privacy | Contact Us
All Times Are GMT