modify visibility of master page controls from pages user control?

G

Guest

I have some hyperlink controls on a master page I need to disable till my
user has made some selections in a user control on a page based on the master
page. How do I reference the Hyperlink controls in the master page? How can I
get the Master Page to re-render itself after I've done this?

Thanks for any suggestions on this.

Dabbler
 
A

Arthur Dent

I would put either a public method on the master page to wrap the
hiding/showing logic, or wrap each hyperlink controls with
Public ReadOnly Property MyLink1 As HyperLink
get
return myHyperLink1
end get
End Property

then in the derived page there is a property (Me.MasterPage i think) which
you can cast to the specific type of your master page.

So with in the derived page you could do something like

CType(Me.MasterPage, myMasterPageClass).MyLink1.Visible = (...some boolean
expression...)

If you have a base page class from which all your pages derive, you could
wrap the MasterPage cast in a property on that base class,
(this is only really simply feasible if you only use a single master page in
your application)
something like...

Class BasePageClass
...
Public ReadOnly Property MyMaster As myMasterPageClass
Get
Return DirectCast(Me.MasterPage, myMasterPageClass)
End Get
End Property
...
End Class
 

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

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top