Access Control

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have am adding a user control to a master page.
In my user control VB code I need to access a control which is in the
master page.

I tried:
Dim myPanel As Panel = CType(Me.FindControl("Panel1"), Panel)
Dim myPanel As Panel = CType(Page.FindControl("Panel1"), Panel)
Dim myPanel As Panel = CType(MyBase.FindControl("Panel1"), Panel)

All of them gave me an error.

Could you tell me how to solve this?

Thanks,
Miguel
 
You have to use the Master property, like this:

Dim myPanel As Panel = CType(Master.FindControl("Panel1"), Panel)

Jason
 
Back
Top