显示从后面ASP.NET code确认对话框 [英] Show confirm dialog from code behind ASP.NET

查看:83
本文介绍了显示从后面ASP.NET code确认对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想表明从code确认对话框中后。

I want to show confirm dialog from code be hind.

我有一个comfirm对话框A.当我点击一个按钮OK,有人呼吁在code中的方法B为后(用ajax职位:URL / B和B是一个方法有WebMethod属性)。

I have a comfirm dialog A. when I click button OK on A, it was call to the method B in code be hind(using ajax post: url/B and B is a method has webmethod attribute).

在B法我想告诉其他对话和code是流动的:(B是AlertInformLogOut)

In method B I want to show other dialog, and code is flowing:(B is 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);
            }

    }

问题是:对话框不显示

problem is: Dialog not showing.

一些身体能告诉我为什么,我可以从显示的方法对话框有WebMethod属性。

Can some body tell me why, and can I showing dialog from a method has webmethod attribute.

推荐答案

现在的问题是,我记得,一个WebMethod不会更新页面,不像一个ASP:更新面板回电。

The problem is, as I recall, a WebMethod wont update the page, unlike an ASP:update panel call back.

由于您使用的是jQueries 阿贾克斯功能,使用成功呼叫回到那里,而不是试图做到这一点的服务器端。

As you are using jQueries ajax function, use the success call back there, instead of trying to do it server side.

$.ajax({ 
   type: "POST", 
   url: url+"/UpdateAlertInfo",....,
   success: /*Call you Confirm Function Here */
 }

您可以人工肝要考虑使用 $。员额() insteado

You may alss want to consider using $.post() insteado

这篇关于显示从后面ASP.NET code确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆