我几乎没有要查看和更新记录的文本框。这是我在保存或更新之前检查任何重复记录的代码,如果有任何重复记录并提醒用户。javascript 警报弹出“更新”但不弹出“保存”。调试器甚至读取 else 块中的行。我哪里错了?
protected void Save_Click(object sender, EventArgs e)
{
int returnId;
returnId = chkDuplicates(value,1);//function to check for any duplicate value
if(returnId==0)
//save the record
else
ScriptManager.RegisterStartupScript(this,typeof(Page), "MsgSave",
"alert('value exists');", true);
}
protected void Update_Click(object sender, EventArgs e)
{
int returnId;
returnId = chkDuplicates(value,2);//function to check for any duplicate value
if(returnId==0)
//update the record
else
ScriptManager.RegisterStartupScript(this,typeof(Page), "MsgUpdate",
"alert('value exists');", true);
}