【发布时间】:2013-12-22 10:22:40
【问题描述】:
我必须在特定条件下显示确认对话框。然后根据 YES 或 No clicked 进行。我尝试了以下操作。
在 aspx 中:
<script type="text/javascript">
function ShowConfirmation() {
if (confirm("Employee Introduced already.Continue?") == true) {
document.getElementById("hdn_empname").value = 1;
}
}
</script>
<asp:HiddenField ID="hdn_empname" runat="server" />
在cs中:
if (reader2.HasRows)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "showAl", "ShowConfirmation();", true);
}
else
{
hdn_empname.Value ="1";
}
if ((hdn_empname.Value)=="1")
{
//some code to execute
}
但hdn_empname 在调试时显示value=""。
谁能帮我做这件事?
提前致谢。
【问题讨论】:
标签: c# javascript asp.net confirm