如何在asp.net中显示Condition的ListView控件? [英] how to display listview control with Condition in asp.net?
本文介绍了如何在asp.net中显示Condition的ListView控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生,
如何在asp.net中显示带有条件的列表视图控件?
我有3个角色,
角色1. Admin_Role:显示所有列(无限制).
角色2. Manager_Role:显示所有列(仅一个列除外)
角色3. Employee_Role:仅显示5列.
注意:
只有一个列表视图.
如何可能.
给我解决方法吗?
通过MOhan>.
解决方案
使用 ^ ]
请参阅此发布 [返回值设置 Control.Enabledproperty
值.
< asp:label id = " runat = " text = " <%#Eval("</span> CompanyName )%>" enabled = " 此处的角色" xmlns:asp = " #unknown" </ asp:label >
< asp:文本框id = " runat = " text = " <%#Eval("</span>地址 )%>" xmlns:asp = " >> Enabled = ' <%#HttpContext.Current.User.IsInRole("ROLE HERE")%>' > </ asp:textbox >
Dear Sir,
How to display list view control with Condition in asp.net?
I have 3 roles,
Role 1. Admin_Role : All columns are display(no Restriction).
Role 2. Manager_Role : All Columns are Display(Except Only one Column)
Role 3. Employee_Role : Only 5 Columns are Display.
Note:
Only one List View.
How to Possible it.
Give me Solution?
By MOhan>.
解决方案
Use RolePrincipal.IsInRole[^]
Refer this Post[^]
Try following:
Set your Control.Enabledproperty
value according to the functionHttpContext.Current.User.IsInRole("ROLE HERE")
returned value.
<asp:label id="lblCompany" runat="server" text="<% #Eval("CompanyName")%>" enabled="<%# HttpContext.Current.User.IsInRole("ROLE HERE") %>" xmlns:asp="#unknown"></asp:label>
<asp:textbox id="txtAddress" runat="server" text="<%#Eval("Address")%>" xmlns:asp="#unknown"> Enabled='<%# HttpContext.Current.User.IsInRole("ROLE HERE") %>'></asp:textbox>
这篇关于如何在asp.net中显示Condition的ListView控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文