仅允许某些用户编辑 ASPxGridView
我有一个 ASPxGridView,我希望允许某些用户对其进行读取,而其他用户对其进行写入访问。理想情况下,这将基于 Active Directory 组。
我该怎么做?
I've got an ASPxGridView that I would like to allow some users to have read and others users write access to. Ideally this would be based on Active Directory groups.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用行的就地编辑,则需要隐藏允许用户编辑网格的控件。
您可以通过使用事件处理程序挂钩 GridView 的 RowDataBound 事件并检查用户的角色来完成此操作。如果检查失败,则隐藏编辑控件。
If you're using in-place editing of rows, then it would be a matter of hiding the controls that would allow a user to edit the grid.
You can do this by hooking into the GridView's RowDataBound event with an event handler, and checking the user's role. If they fail the check, hide the editing controls.
我最终为 DataBound 事件创建了一个事件处理程序并禁用了命令列,如下所示:
I've ended up creating an event handler for the DataBound event and disabling the Command Column as follows:
如果您想仅对某些行有条件地启用
EditButton
,可以使用示例 CQ66919 位于 DevExpress.com。此外,他们还参考了示例E366以获得较新版本的
ASPxGridView
。If you want to enable the
EditButton
conditionally only for certain rows, there is an example CQ66919 over at DevExpress.com.In addition they refer to example E366 for newer versions of the
ASPxGridView
.