【发布时间】:2018-04-06 06:25:18
【问题描述】:
这里是我的代码,但编辑列中的所有内容都启用了 false,我想要 false 编辑按钮取决于状态值
foreach (GridViewRow row in GridView1.Rows)
{
statuse = dt.Rows[0].ItemArray[6].ToString();
if (statuse != null || statuse != "")
{
if (control is LinkButton)
{
LinkButton btn = control as LinkButton;
btn.Enabled = btn.CommandName.Equals("Edit");
btn.Enabled = false;
}
}
}
【问题讨论】:
-
你在找这个吗?
btn.Enabled = statuse == null || statuse == "" -
我会为此使用 RowDataBound 事件。
-
是的,我使用的是行数据绑定。我正在寻找:如果 statuse value = "" then commandfielded enabled false。但是在我尝试之后,所有命令编辑在状态有或没有值的地方都变为假
标签: c# asp.net gridview commandfield