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: 11/2/2007 8:53:20 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 103 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
mcvicar
Asp.Net User
Accessing Properties in Master Pages when defined at run time11/2/2007 8:53:20 PM

0/0

I have 2 master pages. Depending on who is logged in I want to use a different master page, and then access public properties of the master page. Both master pages expose the same properties. For example in the code behind I implement:

        if (testValue == "123")
        {
            Master1 masterpage = (Master1)Master;
            masterpage.Property1 = 4;
        }
        else
        {
            Master2 masterpage = (Master2)Master;
            masterpage.Property1 = 5;
        }

However, one of the Master Page objects is not found when compiled. If I change the

MasterPageFile="~/Master2.master"

on the aspx page then the Master2 object is found, but MAster1 is not. And vice versa.

Does anyone know if there is anyway to achieve this?

Thanks

Adam.Kahtava
Asp.Net User
Re: Accessing Properties in Master Pages when defined at run time11/2/2007 9:23:26 PM

0/0

What part of the ASP.NET Page LifeCycle are you swapping your MasterPages? I believe you should be setting it in the PreInit event. Here's a link that may be of further use: ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps

If you post your code behind source, we may be able to help you further. 


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


Free Download:

Books:
ASP.NET 2.0 Cookbook Authors: Michael A. Kittel, Geoffrey T. LeBlond, Pages: 989, Published: 2005
Microsoft Visual C# 2005 Unleashed Authors: Kevin Hoffman, Pages: 692, Published: 2006
ASP.NET 2.0: A Developer's Notebook Authors: Wei Meng Lee, Pages: 326, Published: 2005
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
ASP.NET 2.0 MVP Hacks and Tips Authors: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan Goodyear, Pages: 400, Published: 2006
ASP. NET V. 2. 0-the Beta Version: The Beta Version Authors: Alex Homer, Dave Sussman, Rob Howard, Pages: 620, Published: 2004
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
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
Learning C# 2005: Get Started with C# 2.0 and .NET Programming Authors: Jesse Liberty, Brian MacDonald, Pages: 528, Published: 2006

Web:
Accessing Properties in Master Pages when defined at run time ... Accessing Properties in Master Pages when defined at run time. Last post 11-02- 2007 5:23 PM by Adam.Kahtava. 1 replies. Sort Posts: ...
Working with ASP.NET Master Pages Programmatically Accessing members that are defined on the master page, which can consist of public properties and methods or controls. Attaching master pages to a content ...
ASP.NET Master Pages Tips and Tricks Pages that need to access the HeaderLabel property, but don't want to ... This feature can be used to provide a run-time reference to a master page and get ...
Examining the out of the box Master Pages in SharePoint ... Sep 15, 2008 ... To access a SharePoint master page gallery go to a SharePoint site .... Site master pages are defined by ~masterurl/custom.master in the ...
CodeGuru: An In-Depth Coverage of ASP.NET 2.0's Master Pages: Part ... The Page class has a property called Master which, at runtime, references the ... Accessing Methods and Properties of the Master Page. Master pages not only ...
Master Pages in ASP.NET 2.0 :: DotNetJohn Jul 31, 2004 ... In addition, the content page can override properties defined at the ... are dynamic attributes defined at runtime within the content page. ...
Master Pages in ASP.NET 2.0 Accessing Master Page Controls from Content Pages ... allows the developer to change the master page associated with a content page dynamically at run-time. ...
ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps Apr 11, 2006 ... Master property and FindControl to locate the QueryBox TextBox by ..... Although nested master pages work at runtime, they do not work in ...
User Control Methods From Various Levels of Master Pages - ASP.NET ... Since I won't know which Master Page is being used until runtime, ... property to the custom base master page class and access the property. ...
Master Pages, Themes, and Control Skins Master Page past this point results in a runtime exception. .... If you have a property defined in both a control and in the skin file, the skin file ...

Videos:
Using ROSE to Mitigate Performance Trade-offs Google TechTalks April 03, 2006 Daniel Quinlan ROSE is a tool for building source-to-source transformation tools for the optimization of C ...
Long Beach City Council Meeting Long Beach City Council Meeting
Santa Monica Council Meeting Santa Monica Council Meeting




Search This Site:










am i designing this right?

sidebar and content area layout problem

we don't need a templated gui.. do we still have to use master pages?

dynamic menu population (from database)

dynamically create sitemapproviders

wanting to modify the bread crumbs menu

how to move web.sitemap

keep a treeview's state?

theme + menu + imageurl

styling hierarchical menus using treeview

treeview's treeview_hovernode error

remove arrow from menu

themes not being overriden

can you load a profile?

popup calendar problem

master page will not allow request.form values to return data

form tag in master page

change relative path problems

contentplaceholder rendering spans?!

best way to do a three level menu other than the default pop outs in menu control

treeview and javascript

unable to get checked nodes in my treeview

setting masterpage controls from content page

appearance of masterpages in vs 2005

javascript reference to the field that want to be set

getting data to the master page

site maps and query strings

treeview nodes..

image used in skin not always available

master page question.

  Privacy | Contact Us
All Times Are GMT