pass variable to javascript

G

Guest

I have a javascript menu in my app, I need to hide certains menu options
based on the credentails of the user logging into the app. How can I hide
menu items on a javascript menu based on log in creditionals?

example:
if the user logged in is a Owner then he would see "wholesale" as a menu
option, if
its a customer then "wholesale" should not appear as a menu option
 
N

Nathan Sokalski

Simply use conditional statements in your ASP.NET code to generate the
appropriate JavaScript. If there are a large number of differences between
the menus for different credentials, you could either separate the
JavaScript into a number of subroutines that you call with different
parameters or just have two .js files and in your page's header specify the
appropriate one as the src attribute of the script tag. What technique you
use is up to you, which one is best depends on what kind of techniques you
use in the menu code and what you are most comfortable using. Good Luck!
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top