Er Kapil Kaushik
Er Kapil Kaushik

Reputation: 72

finding master page control from another master page?

I am using two Different master page in my site. On one master page i am using a LoginStatus control. So wanna access that LoginStatus control from other. I have no great knowledge about how to find the controls from one master page to other.

Is there any way to achieving this. Any help is deeply appreciated. Thanks.

Upvotes: 1

Views: 252

Answers (2)

nunespascal
nunespascal

Reputation: 17724

Unless you are using nested master pages, you cannot access one master page from another.
A Page would normally use only one master page at a time.

The users login status, however is not dependent on the LoginStatus control. You can show this status everywhere.

Refer: ASP.NET Login Controls to get an idea about the right control to use.

Upvotes: 0

Jigar Pandya
Jigar Pandya

Reputation: 5977

Well if there is single master page and content page you can access control using

  Label lblinMaster = (Label)This.Master.FindControl("Label1");

and the same way to access control in nested master page you can use following.

Label lblinParentMaster = (Label)Master.Master.FindControl("Label1");

Hope this helps.

Upvotes: 1

Related Questions