【问题标题】:I want to make datagrid readonly in behnd code, but do not see the option我想在 behnd 代码中使 datagrid 只读,但看不到该选项
【发布时间】:2018-11-28 17:39:30
【问题描述】:

我有一个数据网格“AWGrid”,它有 EditCommandColumn 并删除 Templatecolumn。

当页面加载时,我正在检查用户权限,如果用户没有适当的角色,它应该只能查看内容并且应该禁用编辑和删除按钮。目前,我在每个事件上禁用这些按钮,当它们被点击时。

if (!wrp.PageAuthenticationForUser(currPage))
 {
    e.Item.Cells[0].Enabled = false;
     return;
 }

我想禁用页面加载本身的那些按钮。像这样的

if (!wrp.PageAuthenticationForUser(currPage))
            {
                txtLbl.Text = "You are Not Authorized to do perform operation setup.";
                //AWGrid.ReadOny = true;
            }

但这似乎不起作用。有没有一种简单的方法来实现这一点。

提前致谢。

【问题讨论】:

    标签: c# asp.net asp.net-mvc-4 datagrid


    【解决方案1】:

    将您的禁用按钮编码放在 gridview rowdatabound 事件中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-14
      • 2023-03-31
      • 1970-01-01
      • 2018-08-25
      相关资源
      最近更新 更多