如何为两个不同的用户启用或修改文本框 [英] How Do I Enable Or Diaable Textbox For Two Different Users

查看:79
本文介绍了如何为两个不同的用户启用或修改文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在同一页面中有两个不同的文本框,这些文本框的id是经理,它是id =经理,而对于员工,它是id = employees.when经理用他的用户名登录我想要id = manager to当员工使用他的用户名文本框登录时,启用了id = employees。

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.

推荐答案

所以,基本上你想在识别 用户的角色



我假设您正在使用某种机制来识别用户的角色。为此,您可能在用户表中有一个,或者为用户角色添加一个单独的表。



只需从用户登录时从数据库中检索 Role 值。然后尝试运行基于此的逻辑。如下所示。

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.
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;
}


这篇关于如何为两个不同的用户启用或修改文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆