如何启用/禁用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;
}
但我无法停用图标
答案 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;
}
您必须使用“已启用”进行设置。