Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Access Control (http://www.velocityreviews.com/forums/t383923-access-control.html)

shapper 12-14-2006 02:05 AM

Access Control
 
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


Jason Kohlhoff 12-14-2006 04:25 AM

Re: Access Control
 
You have to use the Master property, like this:

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

Jason

"shapper" <mdmoura@gmail.com> wrote in message
news:1166061926.386540.60580@n67g2000cwd.googlegro ups.com...
> 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
>



All times are GMT. The time now is 06:03 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.