根据我的应用程序中的某些值,我需要显示带有确定和取消的确认框,如果它们单击确定,它应该继续并导航到另一个页面,否则如果它们单击取消,它应该保持在同一页面。使用Page.ClientScript从呼叫获得响应
我遇到的问题是,弹出不显示,除非我添加return语句如下
if (true)
{
Page.ClientScript.RegisterStartupScript(this.GetType(),
"ConfirmBox", "confirm('The numbers selected are not in the directory,"
+ sb.ToString()+
" you wish to continue?');", true);
return;
}
Response.Redirect("~/homepage.aspx");
正如你可以看到这是行不通的,因为它永远不会去,因为重定向返回,但没有返回,即使条件为真,它也会跳过弹出窗口。我怎样才能做到这一点?
请不要使用您的签名。 http://stackoverflow.com/faq#signatures – Pankaj 2012-04-16 03:11:28