CodeVerge.Net Beta


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




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 5/23/2006 3:22:02 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 123 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
danielsb@gunner
Asp.Net User
accessing a master page public variable from user control5/23/2006 3:22:02 PM

0

I have a public variable in my master page

         Public CurrentUser As New gunnery.objects.users.CurrentUser

I set this variable in the master page init.  That part seems to work fine. In my aspx page I can access the variable as follows

         CurrentUser = Me.Master.CurrentUser

That also works fine from the page-load event of the aspx page.

The problem I am having is accessing the variable from a usercontrol.  I have tried a few things like this:

userID =

CType(Me.Parent.Page.Master, GunnNet).CurrentUser.UserID

In this line GunnNet is the class name of the master page (name of master page is GunnNet.master).  I keep getting an error that GunnNet is not defined.

Suggestions would be greatly appreciated. 

thanks

bj daniels


BJ Daniels
Director of Technology
The Gunnery School
[email protected]
spencery
Asp.Net User
Re: accessing a master page public variable from user control6/15/2006 10:30:21 PM

0

Here's how I got it to work (C# version):

If you ever have a need to access properties of a master page from a user control in ASP.NET 2.0, here?s how you do it:

Add to .ASCX file:

<%@ Reference VirtualPath="~/Templates/ListDetailTemplate.master" %>

Cast the reference as follows:

            ((ASP.templates_listdetailtemplate_master)Page.Master).PageHeightOffset = 250;

 Translate that to VB.NET & you should be good to go.

-spencer

 

 

2 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
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Computer communication: ICCC ; International conference. proceedings : Towards a new world in computer communication ; Authors: R Parodi, Computer communication, Pages: 0, Published: 1992
Mastering ASP.NET with C# Authors: A. Russell Jones, Pages: 816, Published: 2002
Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007
Pro Visual Studio 2005 Team System Application Development: Application Design Authors: Steve Shrimpton, Pages: 768, Published: 2006
The Use of Psychological Testing for Treatment Planning and Outcomes Assessment: Instruments for Adults Authors: Mark Edward Maruish, Pages: 1032, Published: 2004
Dreamweaver 8: The Missing Manual Authors: David Sawyer McFarland, David Pogue, Pages: 936, Published: 2006
Multiskilling for Television Production Authors: Peter Ward, Alan Bermingham, Chris Wherry, Pages: 404, Published: 2000

Web:
accessing a master page public variable from user control - ASP ... I have a public variable in my master page ... If you ever have a need to access properties of a master page from a user control in ASP. ...
Mehfuz's Blog: Accessing Master page variables from user control Now,calling a public method in master page from user control is bit tricky. ... This process of accessing public variable though simple, yet very effective ...
Reference A var on Master Page from User Control I have setup a public variable in the Master Page "code-behind-file". ... I've also tried wrapping Master Page, Usercontrol in the same namespace and ... access the master in the wrong way? Or am I missing something. ...
Master page variable - access on content page - Application ... I then want the content page (and controls on it) to be able to access ... To do what you want, make the variable in the Master Page Public. ...
How Can I access Master Page Member Classes and Variables - ng.asp ... Here are my public properties public User My_user .... I use access to previous page's (that is master page) control to do things like: ...
Master Pages - Strongly-Typed control access public variable to expose a Label control on the master page): ... user should not logged in more than one using diffferent machins on ...
Updating a control in a MasterPage from a UserControl | Egil.dk Jul 5, 2007 ... Pages that host the UserControl can then subscribe to the event and ... Create a public property on the MasterPage for each access to the status label. ... message) { // Copy to a temporary variable to be thread-safe. ...
Master Pages - Strongly-Typed control access - bytes Is there a way of accessing *controls* in strongly-typed way (any ..... public variable to expose a Label control on the master page): ...
disable usercontrol on the load of master page - Stack Overflow public partial class Site1 : System.Web.UI.MasterPage { protected void Page_Load (object ... The user control is not declared as a local variable in the MasterPage. ... How to access the context object as an array in PageMethods callback ...
RE: Reference A var on Master Page from User Control I have setup a public variable in the Master Page. "code−behind−file". Now I would like to set that value from the UserControl, but I can't seem to find a ...






change menu style,

dynamic treeview control in master page

submitting a form in a contentplaceholder from a javascript function on the master page?

relational links noob! :(

2.0 menu control not working in beta 2

disable automatic inclusion of stylesheets

making wizard control horizontal

nested master page issues

how to avoid the space between the div .

images not appearing in treeview

who includes who?

left panel when logged in

download themes - help please...

setting activestepindex on a wizard control

css for a button

missing themes functionality

please help with the error: requires page.header to be non-null

menu security not working

changing cell background color

accessing contentplaceholderid from master page codebehind

dynamically add nodes to a sitemappath

image disppeared from master page!!

issue in adding user control

where do i put my scripts?

any problem in using panel around the whole page?

i have 2 problems maybe someone can help me....

site map error

asp.net 2.0 wizard control

problem in the sitemapprovider

master page in gac refrencing another gac dll

   
  Privacy | Contact Us
All Times Are GMT