Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi friends, I have small doubt in asp.net 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
 
this?
 
Please any one can help me with this problem
 

Thanks & Regards
Ganesh
Posted 11-Dec-12 18:30pm
Ganeshcse2.3K
Comments
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');
GetAllItemsOnLoad();
}
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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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() {
    $("#dvSave").hide();
    $("#dvSaveSubmit").hide();
    $("#dvClaimDiscount").hide();
    $("#dvApproveWon").hide();
    $("#dvAddProduct").hide();
    $("#dvReject").hide();
    $("#dvApprove").hide();
    $("#dvRevisebtn").hide();
}
 
Like this you can also implement your code according to your need.
 
Thanks
  Permalink  
Comments
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');
GetAllItemsOnLoad();
}
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 OriginalGriff 350
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 PIEBALDconsult 110
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2014
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