Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a same page there are two different text box and id of these text box are for managers it is id= manager and for employee it is id= employees.when manager log in with his user name i want id= manager to be enabled and when employee log in with his user name text box with id= employees to be enabled.
Posted

1 solution

So, basically you want to perform something after identifying the Role of User.

I assume, that you are having some mechanism to identify Role of a User. For that you might have a Column in User Table or a separate table altogether for User Role.

Just retrieve that Role value from Database, while User Logs in. Then try to run a logic based on that. Something like below.
C#
string userRole = roleRetrievedFromDatabase; // Retrieve this from Database

if(userRole.Equals("manager"))
{
    manager.Enabled = true;
    employees.Enabled = false;
}
else if (userRole.Equals("employee"))
{
    employees.Enabled = true;
    manager.Enabled = false;
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900