C# - Can't Access Master Page From User Control

Jul 17, 2010

My master page code looks something like this:

namespace Recipes
{
public partial class MasterPage : System.Web.UI.MasterPage
{
...
public void UpdateUserLogin()
{
NicknameLbl.Text = ((Recipes.BasePage)Page).CurrentUser.Nickname;
}
...
}
}

I want to call the UpdateUserLogin() method from a user control, something like this:

((Recipes.MasterPage)this.Page.Master).UpdateUserLogin();

But for some reason the compiler doesn't know Recipes.MasterPage (are you missing an assembly blablabla).

Maybe the problem is that I added the Recipes namespace around MasterPage manually, it wasn't added by VS. By the way I'm using VS Web Developer Express 2008.

View 4 Replies


Similar Messages:

Getting Access To A Custom Master Page From A User Control

May 24, 2010

We have created a Master page that inherits off the asp.net Master class.We have also got ui controls that inherit off the standard asp.net ui control class.Our Master page has a public member variable. We need to be able to access that member variable from the ui controls that we use.However we can't seem to get at it? Is it our architecture that is wrong? Or the idea itself - user control getting acces to Master page variables?

View 2 Replies

C# - Access Master Page Public Method From User Control/class/page

Oct 25, 2010

I am to access a method on my master page. I have an error label which I want to update based on error messages I get from my site.

public string ErrorText
{
get { return this.infoLabel.Text; }
set { this.infoLabel.Text = value; }
}

How can I access this from my user control or classes that I set up?

View 3 Replies

Web Forms :: Access User Control Of Master Page In The Content Page

Jan 27, 2010

I have a user control in the master of my website and I want change some property of that control from the content page.

View 3 Replies

User Controls :: Find And Access Master Page Control From UserControl Inside Content Page

Jan 24, 2014

On masterPage i have button btnTest, how hide button from masterPage on userControl.ascx

example:  

btnSecondPage_click
{
   btnTest.visible = false;
}

View 1 Replies

Visual Studio :: Access Master Page Variable From A User Control

Apr 10, 2010

I am using vb.net/asp.net 2005. I have a master page that displays a child content page. The child content page contains a user control that I created. In the user control I would like to access a variable that is set in the Master page.

View 3 Replies

Web Forms :: Access Public Property Of User Control In Master Page On Child Pages?

Nov 29, 2010

How can one access public property of User Control In Master Page on child Pages.

View 1 Replies

Web Forms :: Access "y" Master Page Methods In User Control?

Mar 30, 2010

I have lot of methids in my mastre page how do i use them in my User control? I dont want to copy paste the code

View 2 Replies

Access A Control In Master Page Using Javascript Within The Master Page Itself?

Sep 16, 2010

How to access controls in master page using javascript? The master page consists of a search textbox, on key down event of the control I call a javascript function writtern inline of the master page. I get the value of entered in textbox in that javascript function. I have tried giving document.getElementById("<%=txtSearch.ClientID %>").value as well as document.getElementById("txtSearch").value. Both display error. I have to access the textbox control from within the master page itself!

View 1 Replies

Web Forms :: Accessing A Public Property Of A Nested User Control In A Master Page From A Pages' User Control?

Sep 10, 2010

I've got a web site that has a master page and that master page (mpMaster that has a user control ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page
and on this page I have another user control (ucPageControl), I need to find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all?

View 5 Replies

AJAX :: Access Control Inside LoginView Placed In Master Page From Content Page

Dec 2, 2013

this hierarchy of master page

|--main.master 
|-- index.aspx 
|-- user.master 
|-- login.aspx
 
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/PageCommon/login.aspx" id="HeadLoginStatus" runat="server" color="#87cfe6">Log In</a> ]

[CODE]....

View 1 Replies

AJAX :: How To Access Image Control In Master Page From Content Page

Oct 9, 2013

how to upload image from child page to image field on master page in asp.net vb.

View 1 Replies

Web Forms :: Access Control Declared In Master Page In Content Page

Dec 8, 2012

How to access a control declared in a Master Page in a content page.I have a ModalPopUpExtender in Master Page and i want to access it from a content page, how can i do that.

View 1 Replies

AJAX :: Find Script Manager Control In Master Page And Access It From Content Page

Dec 11, 2013

I looked at your example URL....I have ScriptManager in masterpage how call  ScriptManager from masterpage in editorPage.aspx if (Script Manager 1.IsInAsyncPostBack)

View 1 Replies

AJAX :: How To Access Master Page Dropdownlist Control SelectedIndexChanged Event Inside The Content Page

Mar 20, 2010

i want to give id of dropdowncontrol inside master page, how can i assign this control id in trigger of updatepanel inside content page

View 1 Replies

Web Forms :: Can't Access A Control In The Master Page From A Content Page

Dec 16, 2010

Does any know why I can't access the my custom user control StatusBar which is declared inside a masterPage?

In the ContentPage, I tried referencing the control this way "this.Site.stastusBar" and "this.Master.Status" and neither one works. Both instellisense warns me that "statusBar" does not exist.

Below is my Aspx code and code-behind:

[code]....

View 3 Replies

Web Forms :: Access Master Page Control Value On Content Page?

Mar 25, 2010

on master page, i have declared a label control & set value to it.now on content page, i m able to find the control, but the value is alwasy null & not the one which was set.when i debugged, content page's load event is called first, after that the master page is called.so where should i access the master page control so that i get the set value.

View 4 Replies

Web Forms :: Access Control In Master Page From Child Page?

Mar 30, 2010

I need to make set values to controls in a master page from the child page. Simple LinkButton - nothing special.

View 6 Replies

Page Life Cycle Sequence Between Master Page And Child Page And User Control?

Jun 4, 2010

I want to share a common page load and page init events sequence between Master page and child page and User Control as described below:

Let us have the following components:-

1. TestMaster.master -> It is the master page

2. TestChild.aspx -> It is the Child page

3. TestUserContrl.ascx -> It is the UserControl present within the TestMaster.master page.
[code]...

View 6 Replies

Web Forms :: Access Master Page Control From File?

Jun 30, 2010

Long Time didn't contact you . Now I am working with a new site I have a masterPage file in this master page (General.Master)I added a label to tell the user his status whether registered or not. all my pages belong to this master thus all pages have this label displayed in them with the same text. now in some page (Regesteration.aspx) it also belongs to the general master. but I want to change the text of the label in the master page to be some other text. How can I access the property Text of the control (LoginStatusLb) in the (General.Master) to change it only in this certain page

View 11 Replies

Web Forms :: Access Control - Not Created By Master Page?

Jul 30, 2010

i am making an asp.net web application.. i wants user to give the facility to login and

View 3 Replies

Web Forms :: Unable To Access Master Page Control?

Apr 26, 2010

I am using asp.net 3.5 with C# to build web application. I am using master pages. I had a label in masterpage. I want to set some text in that label from content page. I have written following code for that

Label lbl = (Label)Master.FindControl("lblUserName");
lbl.Text = "Guest";

but it is giving an exception "Object reference not set to an instance of an object." What could be the problem, if sombody can put some light on it.

View 5 Replies

VS 2010 - Updating Master Page Control From User Control

Aug 19, 2010

I have a label on my master page (called mainMenu) that shows the number of items in a cart. The label wasn't getting updated when the cart was cleared until after an additional postback or redirect so I created a method on the master page called UpdateNumberOfItemsInCart to update the label text.

Using the MasterType directive on the Cart page allowing me to strongly type the master page, I can access the update method from the Cart page. There is a user control also named Cart that actually contains the 'clear cart' button so I setup an event on the user control also called UpdateNumberOfItemsInCart. I wire up the Cart control's event on the Cart page which then makes a call to Master.UpdateNumberOfItemsInCart();

So far so good except when I wrap the Cart control with an update panel the update to the cart count label doesn't happen.

[Code]....

View 4 Replies

Web Forms :: Cross-page Postback From User Control Included In Master Page?

Apr 4, 2010

I am tring to send form values to a page from a user control. I included the user control in a master page.When i use page.previouspage it can not get value. is there any way to send form data to a page from a user control included in a master page?

View 5 Replies

User Control Properties That Located In Master Page From A Child Page?

Jan 11, 2010

I have user control that is part of a panel that located in my master page in every page i need different setting for that user control.

for example in page 1 i need to set the AutoPostBack property to true but in page 2 i need it to be false.

so my question is how can i user control properties that located in master page from a child page?

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved