CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/21/2007 6:16:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 20 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
tom_w
Asp.Net User
Include labels in a master page that are assigned text by pages1/21/2007 6:16:34 PM

0/0

Hello all,

I think I may have difficulty articlating this all.

I am using master pages.  I have that working well... my main template.master is being employed by several pages.

Now I want to logically build my navigation.  Based on whether or not the user is logged in I want the nav to appear differently.  I have a method in a preRender event to assemble the nav's html.

BUT when I add an <asplabel id="lblNav" runat="server" /> it seems to be inaccessible by my pages that are using the master page.  Currently I have to add a content placeholder for the nav and then add it to every page.  Obviously, that is less than ideal. 

How can I add a control to the master page and then be able to assign/modify its value in a page that is built from the master page?

Perhaps I am missing something, but I am somewhat unfamiliar with .NET.


 

Nullable
Asp.Net User
Re: Include labels in a master page that are assigned text by pages1/22/2007 1:28:56 AM

0/0

You can get the reference to the control by using the following code :)

Control myControlThatIsOnTheMasterPage = this.Master.FindControl("theControlsID");

myControlThatIsOnTheMasterPage.Visible = false!!! (or whatever)

... you can use the control's type too..

DropDownList myControlBlahBlah = (DropDownList)this.Master.FindControl("myDList");

Hope this helps.
 


-Timothy Khouri
http://www.SingingEels.com/
Developer / Architect / Author
tom_w
Asp.Net User
Re: Include labels in a master page that are assigned text by pages1/22/2007 4:06:24 PM

0/0

Wow, you nailed it.  I wasn't sure anyone would understand what I meant.  I cast the contols as their type and all worked wonderfully.

Thank you Nullable.

 

Tom
 

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Mastering InDesign CS3 for Print Design and Production: for print design and production Authors: Pariah S. Burke, Pages: 492, Published: 2007
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
The Software Catalog: Microcomputers, Winter, 1990 Authors: Menu International Software, Pages: 0, Published: 1990
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
Using PageMaker: Macintosh Version Authors: C. J. Weigand, Pages: 450, Published: 1990
ASP.NET 2.0 Everyday Apps For Dummies Authors: Doug Lowe, Pages: 504, Published: 2006
Microsoft Word Version 2002 Step by Step Authors: Perspection, Inc, Pages: 336, Published: 2001
Microsoft Office FrontPage 2003 for Windows: Visual Quickstart Guide Authors: Nolan Hester, Pages: 462, Published: 2003

Web:
Working with ASP.NET Master Pages Programmatically Text = "Master page label = " + mpLabel.Text End If ... during the initialization stage of page processing, a master page must be assigned before then. ...
Master Pages in ASP.Net 2.0 - An Advanced Look Specifying the Master Page Programmatically : The Official ... In other words, it is imperative that the master page being assigned to the content ...

EXERCISE 1: CREATE A SIMPLE MASTER PAGE, AND TWO CHILD PAGES Change the Label text to “Hello ASP.NET Master Pages! ... to the solution and the master page has been assigned as Level100.aspx’s MasterPageFile ...
ASP.NET.4GuysFromRolla.com: Passing Information Between Content ... Jan 31, 2007 ... The string input passed into this method is assigned to the Label Web control's Text property. Using this method, the Master Page's content ...
need help accessing label value from master page into the content ... EventArgs e) { Label mpLabelc = (Label) Page.Master.FindControl("labelm"); labelc.Text = "from content page = " + mpLabelc.Text; ...
Master page events Label1.Text = "Master page label = " + mpLabel.Text ... initialization stage of page processing, a master page must be assigned before then. ...
Page 3 - How to Use Master Pages (Conclusion) Dec 8, 2005 ... That way, if the content page has assigned a value to this label in its Page_Load procedure, the master page’s Page_Load procedure won’t ...
C# Free Training Courses: Access master page members from a page Jun 17, 2008 ... public Label TitleLable ... Then we create a page that is using this masterpage. ... Master.TitleLable.Text = "New Title is Assigned"; ...
CodeProject: ASP.NET 2.0 Master Pages. Free source code and ... Label1.Text = this.MasterPageFile;. This will show the path of the Master Page file into the label. Actually you can get a reference to the Master Page from ...





Search This Site:










inheriting dropdownlist & handling postbackdata (vb)

performance gain

multiple controls error

digital cert for a document

2.1.2 vs. 1.0.10e performance issues

struggling with membership

customvalidator errormessage not displayed in createuserwizard

how to get hyperlink click of repeater

add link to event content

edit excel cell

localization problem when loading controls within a module...

how to convert raw binary data to hex-ascii?

navigation control for asp.net

looking for a rotator control - similar to component arts rotator control

accessing a com object from asp.net

role varification in onloggedin event

stack overflow

contact form

cannot send e-mail using c# .net

how do i enable writing to the eventlog??

new free module - gruposur backuplite

toolbars in asp.net2.0

sitemappath in menu navigation

msde

welcome to the web deployment projects forum!

errors in custom modules with address control

how dnn 3.0 supports extended user attributes ?

possible to change membershipprovider attributes dynamically?

multiple checkboxes

vs hangs when adding a web project

 
All Times Are GMT