在我的DataView中第6列为删除按钮,第7列为编辑按钮下面一端代码是为删除按钮写的,测试正确.可是添加编辑按钮后也会触发这段代码并报错.请问如何改写代码使得按编辑按钮的时候可以跳过这段代码?if (e.Row.RowType == DataControlRowType.DataRow) //如果选中了某一行操作
{
((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick","return confirm('删除吗?')");
}用的是VS2005
{
((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick","return confirm('删除吗?')");
}用的是VS2005
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.CommandName == "Del")//这里判断下执行的哪个命令
{
……
}
}