Click here to Skip to main content
11,496,146 members (874 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
Hi friends, I have small doubt in web app

I have 2 divs for 2 types of menu's i.e one menu for All Users except Admin Login and Other

Menu is for Admin Login because I have used this I want to give only some permissions to

users and all permissions to Admin.

For that I have taken 2 div's in which all is HTML Menu Code. based on Session value I am

hiding the menu. every thing is fine but one small problem that I am using javascript ajax

functions to call web service so when any alert message comes the other menu which I was

hiding for that particular session is also visible till I press the message box Ok or Cancel Button.

How can I solve this and I want two menu's also for my logic. Is there any method to solve


Please any one can help me with this problem

Thanks & Regards
Posted 11-Dec-12 18:30pm
vishal jodh at 11-Dec-12 23:45pm
pls past u r java script code so i can understand better
Ganeshcse at 13-Dec-12 3:59am
if (LoginUser == 3)
$("#AdminMenu").attr('class', 'MenuCSS');
$("#UserMenu").attr('class', 'MenuCSSHide');
else {
$("#AdminMenu").attr('class', 'MenuCSSHide');
$("#UserMenu").attr('class', 'MenuCSS');
akee seth at 12-Dec-12 0:35am
You should hide other menu before alert message. For better understanding, can u please post your ajax call?
Ganeshcse at 13-Dec-12 4:02am
the menu is hide based on the login user again why should I hide again and again when ever I have alert message and I have many alert messages, for reference Please see above comment for code how I am hiding the div's

1 solution

Hi Ganeshcse,

Yes there is one way. I had the same problem faced in my project.
You can define one more javascript method before the service call and hide the div control that is been produced unexpectedly.

I am sharing my code with you for reference.

I had added the following code to hide the unwanted buttons during the popup show.

//Check sataus of the project and call javascript function for hide the unwanted button Image.
 if (CurrentDealStatus == Constant.REGISTRATION_REJECTED || CurrentDealStatus == Constant.PROJECT_WON || CurrentDealStatus == Constant.PROJECT_SAVE ||CurrentDealStatus==Constant.REGISTRATION_APPROVE ||  CurrentDealStatus==Constant.REQUIRES_REVISION)
ScriptManager.RegisterStartupScript(this, this.GetType(),"UserWaitingApprovalButtonHide", "<script type='text/javascript'>UserWaitingApprovalButtonHide();</script>", false);

The client script function is as follows.

function UserWaitingApprovalButtonHide() {

Like this you can also implement your code according to your need.

Ganeshcse at 13-Dec-12 3:59am
Thanks Boss, yes I did in the same way but but not with js function just added a css attr like below

if (LoginUser == 3)
$("#AdminMenu").attr('class', 'MenuCSS');
$("#UserMenu").attr('class', 'MenuCSSHide');
else {
$("#AdminMenu").attr('class', 'MenuCSSHide');
$("#UserMenu").attr('class', 'MenuCSS');

however the div's which are hidden one are visible at the time of message box alert time that's it. Can we fix this also? Please share the code thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 163
3 Sascha Lefèvre 145
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100