Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use a label in a Module 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I'm using a master page with a menu. I have a label on each page that I pass the users "group" to from a session. I'm using that label to build the menu access. I'm trying to do this in a module so I can have the code in one location rather then on each page. how can I build the menu using a module and a session.

any help would be appreciated

Thanks

 
I would not us a module, they are basically an old school "class". But in this instance I wouldn't use a class either.. I would build a user control that encapsulates all of your menu controls and code logic. That then can be placed on your master page.
 
okay,

I will check that out. hopefully I can find some info on that.

Thanks

 
so, would you put the group session label in the user control as well ?

 
you can, it depends on what you want to show and where.
A user control is just a control you build with other controls and code on it. The purpose of it is to make blocks of UI and code reusable so you don't have to place the same code on multiple pages. You just place it on any page you want to use it. This way if something changes, it only changes in one place.
 
how do you find the control on the master page ?

Master.FindControl("MenuControl").Visible = False

The above doesn't work.

Thanks

 
Set a property on the masterpage like showMenu as boolean

On your page (aspx)
Code:
   <%@ MasterType VirtualPath="~/<path>/<masterpage>.master" %>

on your page (vb code)
Code:
   Me.master.showMenu = False

Then on your masterpage, set the control's visible property accordingly

 
okay, so I put a menu control in the master page and also a user ID and group label in the master page as well. I'm trying to avoid checking the group on each page so I want the master page to hold the users group level so I can disable or enable menu options. Is the Menucontrol I created tied to the master page "on load" event ? I can't seem to remove menu items from the master page when a content page gets loaded.

Thanks for helping me with this.

 
Is the menu control a user control placed on the master page? If so, the usercontrol has it's own events.
It is unclear on what you are trying to do. If you have further questions, you should post your masterpage and usercontrol HTML along with any code behind and explain what exactly you are trying to do.
 
Thanks for the info and pointing me in the right direction. I was able to put all my code under the menu user control that I created.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top