【发布时间】:2013-03-16 06:54:47
【问题描述】:
我正在使用以下代码显示确认框。
protected void cmbPayerBucketMain_SelectedIndexChanged(object sender, EventArgs e)
{
ClientScriptManager CSM = Page.ClientScript;
if (!String.IsNullOrEmpty(hiddenF1.Value) || !String.IsNullOrEmpty(hiddenF2.Value))
{
CSM.RegisterClientScriptBlock(this.GetType(), "Confirm", "show();", true);
}
//Some Code
}
和函数show()如下
function show()
(
if(confirm('Chnages you made will be lost. Do you want to continue?'))
{ return true; }
else
{ return false;
}
return
)
但无论我从确认框中选择了什么选项,它都会执行整个代码。在执行整个事件代码后,它会弹出消息框。如何限制组合框等待确认框的响应并仅在用户选择“确定”时才执行事件代码(或“是”也建议我更改确认框中按钮文本的方法。我想将 OK 设置为 YES,将 CANCEL 设置为 NO)。
【问题讨论】:
标签: c# javascript jquery asp.net