ASP.NET环境中后台弹出无刷新环境中的对话框

参考http://www.51cto.com/art/200806/76508.htm

在body中添加

 <asp:ScriptManager ID="sm" runat="server" AsyncPostBackTimeout="360" >
    </asp:ScriptManager>

 <asp:UpdatePanel ID="up" runat="server"><ContentTemplate>
                    <asp:Button ID="Save" runat="server" Text="Save" onclick="Save_Click"/>   
                          </ContentTemplate></asp:UpdatePanel>

后台代码就是:

 if (no_Of_Like == "") ShowMsg(sender, "Please input No.of Likes!");

private void ShowMsg(object sender, string msg)
        {
            ///获取弹出对话框的按钮
            Button button = (Button)sender;
            ///注册对话框的脚本
            ScriptManager.RegisterClientScriptBlock(
            button,
            button.GetType(),
            button.UniqueID,
            "alert('" + msg + "');",
            true);
        }

 

 

posted @ 2013-05-09 09:55  纵一苇之所如-  阅读(394)  评论(0编辑  收藏  举报