在GridView1_RowCommand事件里,如果因为判断有重复的名称而想取消更新时,return是不行的,如:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string strCommandName = e.CommandName;
if (strCommandName == "Update")
{
//判断是否有重复的名称
bool isEixt = true;
if (isEixt )
{
return;
}
}
}
在GridView1_RowUpdating事件里, e.Cancel = true;就行了