【发布时间】:2014-03-13 02:44:57
【问题描述】:
我想从后面的代码中显示确认对话框。
我有一个确认对话框 A。当我单击 A 上的按钮 OK 时,它在代码中调用了方法 B(使用 ajax post: url/B 和 B 是一个具有 webmethod 属性的方法)。
在方法 B 中我想显示其他对话框,并且代码正在流动:(B 是 AlertInformLogOut )
[WebMethod]
public static void AlertInformLogOut(string alertId, string option)
{
//TODO: Open call schedule
var page = HttpContext.Current.Handler as Page;
// PopUp alert notify info
if (page != null)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "script", "AlertSetDialog(" + new JavaScriptSerializer().Serialize(new AlertInformEntity()) + ", 'AlertInforms');", true);
//ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "script", "AlertSetDialog(" + new JavaScriptSerializer().Serialize(new AlertInformEntity()) + ", 'AlertInforms');", true);
}
}
问题是:对话框未显示。
有人能告诉我为什么吗,我可以从一个方法中显示对话框吗?有 webmethod 属性。
【问题讨论】:
-
你如何从页面调用
WebMethod? -
我正在使用 Ajax post:$.ajax({ type: "POST", url: url+"/UpdateAlertInfo",....}
标签: c# javascript jquery asp.net