MasterPage, UserControl and Webform

K

kirkski

The layout of my site is as follows:

I've a MasterPage that contains a UserControl and attached to the
MasterPage is webforms that contain the sites content.

My porblem is how to access the UserControl on the MasterPage from
within the Web Forms. I can access it no problem from the MasterPage
as its available from intellisense. Oh, and i'm using C#

Thanks in advance,

Steve.
 
T

Teemu Keiski

Hi,

with Master.FindControl("UCControl1") where UCControl1 is the id of the UC.
This way yo can get rerefence to the user control.

Another option is op create a readonly property on the Master which exposes
the UC . Then on content page, specify @MasterType directive whichs
strongly-types Master property on content page (e.g on content page
Master.PropertyName gives access to the UC you expose)

You'll see concrete example of it at:
http://forums.asp.net/thread/1168780.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top