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: 12/28/2006 8:01:45 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 23 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
greghsr
Asp.Net User
How can I access the property a control on a master page from the master page's code behind.12/28/2006 8:01:45 PM

0/0

On my master page I have a label. I want to change this label's text property based on an element of the querystring. (label.text = "NewValue")

All child pages using this master will display the same thing so I was trying to put the code in the master page so as not to have to duplicate it for the child pages or put it in a base class and use FindControl.

Is it possible to access from a master page's codebehind the property of a server control that is placed on a master page's aspx? If so how?
(I saw similar questions, but they all came from the view of a child accessing the property.)

Thank you,

Greg
 

Rossoneri
Asp.Net User
Re: How can I access the property a control on a master page from the master page's code behind.12/28/2006 9:04:39 PM

0/0

It works just like any other page with controls on them. You can access them directly from the master page code behind.
greghsr
Asp.Net User
Re: How can I access the property a control on a master page from the master page's code behind.12/29/2006 4:15:11 PM

0/0

Accessing directly, in the manner described below, did not work for me. 

If I drag a textbox control (TextBox1) onto the MasterPage.aspx and in the codebehind reference the text box in this manner "TextBox1.Text = "Hello World", despite code completion indicating the presence of the control, when I compile the webproject I get the error "Error    4    The name 'TextBox1' does not exist in the current context".

If I refer to the textbox in this manner "this.TextBox1.Text = "Hello World" on compile I get the error "Error    5    'MasterPage' does not contain a definition for 'TextBox1' "   

I am using a Web Application Project (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/WAP.asp)  

jasonlindo
Asp.Net User
Re: How can I access the property a control on a master page from the master page's code behind.12/29/2006 8:46:09 PM

0/0

Can you post some code so we can see what you're doing, it's hard to tell from the thread so far.

Thanks

greghsr
Asp.Net User
Re: How can I access the property a control on a master page from the master page's code behind.12/31/2006 9:02:12 AM

0/0

Problem Solved: I messed up. A reserved word was used as the name for the MasterPage. While this did not cause a compile error. It did interfere with functionality.
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET 2.0 Instant Results Authors: Imar Spaanjaars, Paul Wilton, Shawn Livermore, Pages: 456, Published: 2006
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Core Internet Application Development with ASP.NET 2.0 Authors: Randy Connolly, Pages: 1049, Published: 2007
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Pro ASP.NET for SQL Server: High Performance Data Access for Web Developers Authors: Brennan Stehling, Pages: 408, Published: 2007
Expert C# 2005 Business Objects Authors: Rockford Lhotka, Pages: 668, Published: 2006
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Pro VB 2005 and the .Net 2.0 Platform Authors: Andrew Troelsen, Pages: 1034, Published: 2006
Beginning C# 2005 Databases Authors: Karli Watson, Pages: 501, Published: 2006

Web:
Adding Code-Behind Files to Master Pages and Page Layouts in ... Summary: Learn to use code-behind files within master pages and page layouts ... sets the master page URL using the current site's CustomMasterUrl property. ...
Page 3 - How to Use Master Pages (Conclusion) Dec 8, 2005 ... The easiest way to access a control on a master page from a ... Figure 3-8 illustrates a code-behind file for a master page that shows you ...
Less Than Dot - Wiki - ASP.NET: Access Master Page controls from ... Code is hidden, SHOW. Now, we need some way of getting the Master Page to expose the Text property of it's "Label1" control. This is where the Properties ...
How can I access the property a control on a master page from the ... Is it possible to access from a master page's codebehind the property of a server control that is placed on a master page's aspx? If so how? ...
ASP.NET.4GuysFromRolla.com: Passing Information Between Content ... Jan 31, 2007 ... Or existing content pages that use MasterPage X might be updated to use .... Master Page reference in the content page's code-behind class, ...
CodeProject: Inside Master Pages. Free source code and programming ... Let’s say that I have a ListBox control on the master page called listBox1 . And I want to access it. We don’t need to add any code in the master page. ...
Microsoft Certified Professional Magazine Online | Feature Article ... This method requires you to create a public property inside the master page's code-behind file for each control you want to access. This public property is ...
Centralize Master page and Alternate CSS settings - Sander's Blog Aug 29, 2008 ... Control all Master pages, Application Master pages and the ... You'll hard-code this property in the Masterpage, meaning that every ...
ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps Apr 11, 2006 ... A page’s MasterPageFile property sets the master page for the content page ...... get left behind and don’t exist in the control hierarchy. ...
Reference A var on Master Page from User Control other pages can access it. Thanks for any ideas. > Michael > The UserControl has a .Page property, from which you can get its MasterPage ...

Videos:
A New Way to look at Networking Google Tech Talks August 30, 2006 Van Jacobson is a Research Fellow at PARC. Prior to that he was Chief Scientist and co-founder of Packet Design. P...
Charlie Rose - Henry Louis Gates, Jr. / Spencer Wells / Major Gen. Douglas Lute Segment 1: Henry Louis Gates, Jr. of Harvard University talks about his latest project for PBS, African American Lives. Segment 2: Spencer Wells i...
Santa Monica Council Meeting Santa Monica Council Meeting
Long Beach City Council Meeting Long Beach City Council Meeting
Long Beach City Council Meeting Long Beach City Council Meeting




Search This Site:










installation problem

personal website starter kit mailing list

seperate login page

newbie help!!!

album navigational buttons

hosting pwsk on godaddy

telerik and the "white" theme

problem on win2003 server

question: empty aspnet_users table

unable to loging

porting from sql express to sql server

cant get personal web starter kit working

parser error message: the entry 'personal' has already been added

password error

error in application...

web.config error:

conversion failed when converting from a character string to uniqueidentifier

yet more problems with personal web site starter kit db access

sqlexpress database file auto-creation error:

using sql server 2000 fails horribly

emergency!! can anybody recommend downloading site for personal site starter kit tutorials or video

making the "frames" that wrap around the photos more flexible

publishing from asp.net 2.0 to a public web server

cannot get pws and msde to play together!

modified personal_add.sql

connectionstrings

help with website admin tool

add photo error

can personal web site be used on vwdhosting

architecture questions

  Privacy | Contact Us
All Times Are GMT