如何设置为只读或禁用特定的选定子节点. [英] How to make read only or disable the particular selected child nodes..?

查看:138
本文介绍了如何设置为只读或禁用特定的选定子节点.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何将其设为只读或禁用特定的选定子节点..

我的节点仅是treeview节点..
我已经根据登录用户显示了我的节点.
如果用户是管理员"用户,则他可以查看和访问所有节点.
如果该用户是受限用户,那么我们也可以看到该视图.但是,只有他不应该拥有的东西
单击特定节点的权限.
例如,
用户2是受限用户.
他的水平是
类别
| ______ Engg ---单击Engg时,它说没有任何权限
| ______计算机-单击计算机"时,它说没有权限
| ______历史记录-拥有权限,则应转到母版页以加载菜单
| ______数学-没有权利
像那样....

Hi,
How to make read only or disable the particular selected child nodes..?

My node is treeview node only..
i have display my nodes based on the login user.
if the user is a "Admin" User then he can able to view and access all the nodes.
If the user is restricted user, then also we can able to see the view. but, only thing he should not have
the rights to click the particular nodes.
For example,
User 2 is a restricted user.
His level is
Categrory
|______Engg ---when click Engg, then it says no rights
|______Computer --When click Computer, then it says no rights
|______History --Have the rights, then it should go to the master page to load the menu
|______Maths --no rights
like that....

推荐答案

如果登录的用户访问受限,则不要使该节点为只读或禁用该节点,而不显示该节点.
==========更新===========
对于上述答案,我抱歉,您无法使节点不可见.

您可以根据用户权限填充包含节点的列表,并将该列表分配给TreeView.
Rather than making a node readonly or disable make that node invisible if the loggedin user has restricted access.

==========Update============
I am SORRY for suggesting above answer, you cannot make a node invisible.

What you can do is populate list containing nodes according to user rights and assign that list to TreeView.


将数据绑定到treeview时,将访问控制存储在TAG属性中,
例子

Node.Tag = 1; //可以访问
Node.Tag = 2; //无法访问
Node.Tag = 3; //没有权限
之后,在"TreeView1_BeforeCheck"事件中检查

While binding the Data to treeview, store the access control in TAG property,
Example

Node.Tag=1; // Have access
Node.Tag=2; // No access
Node.Tag=3; // No rights
After that in "TreeView1_BeforeCheck" event check for

if(e.Node.Tag==2)
{
 // Prompt user no rights
 e.Cancel = True;
}
elseif(e.Node.Tag==3)
{
 // Prompt no rights
 e.Cancel = True;
}


这篇关于如何设置为只读或禁用特定的选定子节点.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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