一、GridView1_RowUpdating
if(string.IsNullOrEmpty((string)e.NewValues[0])) {
sScript = "alert('欄位不得為空值');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "error", sScript, true);
e.Cancel = true; //取消更新
}
二、SqlDataSource1_Updating
string sScript;
if (String.IsNullOrEmpty(e.Command.Parameters["@NAL_BCP_M"].Value.ToString()))
{
sScript = "alert('欄位不得為空值');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "error", sScript, true);
e.Cancel = true; //取消更新
}