我已提交按钮。在它的点击,我必须从数据库检查一个特定字段的值,然后弹出一个确认,然后根据是或不允许/不允许保存。我可以如何做.. 在使用确认JS函数时,它传递语句并无论如何运行保存程序。要提交确认弹出框内提交按钮,并允许或不允许提交
我的按钮的事件
protected void btnSubmit_Click(object sender, EventArgs e)
{
string ListExam = string.Empty;
DataTable dt = BussObjGoalCert.CheckPlannedStatus(custObjGoalCert);
if (dt.Rows.Count != 0)
{
for (int i = 0; i < (dt.Rows.Count); i++)
{
ListExam = ListExam + (dt.Rows[i]["MultipleExamPlanned"]) + ";";
}
lblExamMultiple.Text = ListExam;
string myScript2 = "confirm('Unselected exam planned under other certification will also be unplanned.Do you wish to continue?');";
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "confirm('Unselected exam planned under other certification will also be unplanned.Do you wish to continue?');", true);
}
Result = BussObjGoalCert.InsertGoalCertification(custObjGoalCert);
}
等什么我做的是检查从后端的一些数据,然后试图有条件地确认功能。 它被调用,但是插入语句也会被运行,而不管这个人选择什么。 如何在JS函数中完成数据库检查。我需要在代码后面执行它。并且允许/不允许完全保存。这是如何完成的。我没有按照答案中的建议使用OnCLientCLick。
你正在使用什么样的按钮? .net或html? – Quannt
你的代码在哪里? –
已编辑该问题。请再次参阅 – Richa