How do you access individual items of an Master Page

Answers were Sorted based on User's Feedback



How do you access individual items of an Master Page..

Answer / rakesh

Suppose we have a Label(lblTest) in the MasterPage(TestMaster.master) and you want to access that in the Content page at that time u can use the following Code.

Page_Load(....)
{
Label lbl = (Label)TestMaster.FindControl("lblTest");
lbl.Text ="Accessed in ContentPage..";
}

Is This Answer Correct ?    6 Yes 1 No

How do you access individual items of an Master Page..

Answer / vijay singh

MultiView mv =
(MultiView)Master.FindControl("Multiviewsidebar");

Is This Answer Correct ?    6 Yes 4 No

How do you access individual items of an Master Page..

Answer / kevin m

Best not to let the content page know about a control.

Expose what is needed by public properties on the master page, makes the solution far more flexible and decoupled.

Is This Answer Correct ?    2 Yes 1 No

How do you access individual items of an Master Page..

Answer / m.ramasubbareddy

There are so many ways to access individual items of an
Master Page

you need to typecast what control you need to find

1.TextBox textbox=(TextBox)this.findcontrol("textbox1");
2.Label labl=(Label)page.parent.fincotrol("lblname") as Label;
3.ContentPlaceholder
cph=(ContentPlaceholder)this.findcontrol("ContentPlaceholder1"
);
Label lbl=(Label)cph.findcontrol("lblname");

Is This Answer Correct ?    1 Yes 1 No

How do you access individual items of an Master Page..

Answer / prayag t

you can also have a public property defined in master pages
to be accessed in other child pages.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

To make Cache item dependent on a file,directory or other cached item ,you should create an instance of which clause?

1 Answers  


Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? a) Application Variables are used to keep state for each connected user. b) Application Variables are used to keep state for the web site c) Application Variables are used to keep state for the application on the server d) Application Variables are used to keep state for all applications objects in the web site.

1 Answers   Syntax Softtech,


What are the benefits of view state?

0 Answers  


What is the difference between Webservice and WCF

9 Answers   IBM, ITC Infotech,


Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?

2 Answers   Siebel Systems,






How do you install windows service?

4 Answers   Tech Mahindra,


Explain the asp.net session state modes.

0 Answers  


How do pass data from one layer to another layer in N-tier architecture?

2 Answers  


What is data cache in sql server?

0 Answers  


What is a session http?

0 Answers  


What is WebService ?

8 Answers   Tanla Solutions, Yahoo,


Explain Session state management options in ASP.NET.

0 Answers   CDC,


Categories