启用/禁用添加,编辑,删除obout网格上的图像按钮的想法?

时间:2017-06-20 09:41:54

标签: c# obout

如何启用/禁用OBOUT网格使用C#或Jquery

添加,编辑,删除图像图标

我试过这段代码:

grdadmin.AllowAddingRecords = false;

protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
    {
        GridDataControlFieldCell cell = e.Row.Cells[10] as GridDataControlFieldCell;
        Control linksContainer = cell.Controls[0].Controls[0];

        bool disableEdit = false;
        bool disableDelete = false;
        disableEdit = true;
        disableDelete = true;
        linksContainer.Controls[0].Visible = !disableEdit;
        linksContainer.Controls[2].Visible = !disableDelete;
        linksContainer.Controls[1].Visible = !disableEdit && !disableDelete;
    }

但我无法停用图标

1 个答案:

答案 0 :(得分:0)

rdadmin.AllowAddingRecords = false;

protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
    GridDataControlFieldCell cell = e.Row.Cells[10] as GridDataControlFieldCell;
    Control linksContainer = cell.Controls[0].Controls[0];

    bool disableEdit = false;
    bool disableDelete = false;
    disableEdit = true;
    disableDelete = true;
    linksContainer.Controls[0].Enabled = !disableEdit;
    linksContainer.Controls[2].Enabled = !disableDelete;
    linksContainer.Controls[1].Enabled = !disableEdit && !disableDelete;
}

您必须使用“已启用”进行设置。