HI all,

I have an page apaearing inside a control, but i needed it to acesso an label in the master page.
This page is not related to the master page because it it was the master page would open with it.

My questions:

its there a way to acess the label in master page from a non related MasterPage, page?
or its possible to conecto to master page without shoing the master page inside a container.

best regards

So you are saying that your .aspx page is not "connected" to the master page? No "MasterPageFile" in the Page directive?

So I dont understand... If this is another master page in the folder structure somewhere, what is the point of trying to access the label control? That other master page is not part of the page that is being shown to the user.

If I'm not understanding, please clarify.

Basicaly i have a "Loose" page, that has to be like that so i can be presented inside a container.
Theres a Master Page, and it working, the "Loose Page" those not make reference to the Master Page.

What i want to know if theres a way to use a Label on Master Page by that "Loose" Page or a whay that i can hide the master page if i turn the "Loose" Page to reference the Master Page.

sorry, i'm having difficulty understanding your description...

so i can be presented inside a container.

So as you are aware, generally master pages will include a <asp:ContentPlaceHolder /> control , then another page (call it child page) would have the ASP.NET/HTML conent within an <asp:Content /> control. You reference the master page in the Page directive in the "child" page.

If you are saying that a "loose" page is one that does not reference the master page, I do not see how you will reference any controls on it, or for what purpose.

If you do "link" the child to the master page, yes you can hide controls in the master page by using the FindControl method. If the master page has an <asp:panel /> control for instance, you can set its visibility to false.

here is an example of how you reference a control on the master page:

void Page_Load(){
 Label label1 = (Label)Master.FindControl("lbl1");
 label1.Text = "My label";
}

You could do the same if its a panel. For example...

void Page_Load(){
 Panel pnl1 = (Panel)Master.FindControl("pnl1");
 pnl1.Visible = False;
}

what i wanted was that the Master page wasnt called with the example "Sales of Day" page, so it can be show in a small container on the side.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.