首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

模式窗体下弹出两次提示异常有关问题!

2012-03-07 
模式窗体下弹出两次提示错误问题!急此帖内容前两天发过,没有得到有效回答,开新帖提问。在打开的模式窗体中,

模式窗体下弹出两次提示错误问题!急
此帖内容前两天发过,没有得到有效回答,开新帖提问。
在打开的模式窗体中,点击服务器按钮控件,在按钮事件中写
ClientScript.RegisterStartupScript(this.GetType(),   "submitOk ",   "alert( '123 '); ",true);弹出两次提示窗体!不明白为何弹出两次,具体代码如下。
起始页为页面一TestPage.aspx
页面1:调用模式窗体的父窗体
<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "TestPage.aspx.cs "   Inherits= "htManage_TestPage "   %>

<head   runat= "server ">
        <title> 1 </title>
        <script   language= "javascript ">
          function   showErrMsg()
                {
                            window.showModalDialog( "TestPageFrame.aspx ", " ", "center=yes;dialogHeight=20;dialogWidth=20;resizable=yes;status=yes;scroll=yes;help=no ");
                }
            </script>
</head>
<body>
        <form   id= "form1 "   method= "post "   runat= "server ">
        <div>
                <input   onclick= "return   showErrMsg(); "   type= "button "   value= "保   存 "   id= "button2 "   name= "btnSave "   />
        </form>
</body>
</html>

页面2:模式窗体的加载窗体

<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "TestPageFrame.aspx.cs "   Inherits= "htManage_TestPageFrame "   %>

<head   >
        <title> 2 </title>
                <base   target= "_self "> </base>
</head>

        <frameset   rows= "0,* ">
        <frame   src= "about:blank ">
        <frame   src= "TestPage2.aspx ">
            </frameset>
</html>

页面3:   模式窗体

<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "Testpage2.aspx.cs "   Inherits= "htManage_Testpage2 "   %>

<head>
        <title> 3 </title>
        <base   target= "_self "> </base>
          <script   language= "javascript ">
        function   showErrMsg()
                {
                            window.showModalDialog( "TestPage3.aspx ", " ", "center=yes;dialogHeight=20;dialogWidth=20;resizable=yes;status=yes;scroll=yes;help=no ");
}
                </script>
</head>
<body>
        <form   id= "form1 "   runat= "server "   method= "post ">


        <div>
                <asp:Button   ID= "Button1 "   runat= "server "   OnClick= "Button1_Click "   Text= "Button "   />
                <input   type= "button "   value= "关闭 "   onclick= "window.close() ">
        </div>
        </form>
</body>
</html>


页面4:模式窗体的后台代码
using   System;
using   System.Data;
using   System.Configuration;
using   System.Collections;
using   System.Web;
using   System.Web.Security;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.WebControls.WebParts;
using   System.Web.UI.HtmlControls;

public   partial   class   htManage_Testpage2   :   System.Web.UI.Page
{
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
        }
        protected   void   Button1_Click(object   sender,   EventArgs   e)
        {
                ClientScript.RegisterStartupScript(this.GetType(),   "submitOk ",   "alert( '123 '); ",true);
        }
}

在这里先谢过各位达人,不吝赐教。

[解决办法]
应该是``
ClientScript.RegisterStartupScript(this.GetType(), "submitOk ", "alert( '123 '); ",true);

这句会重复提交页面``
[解决办法]
启动脚本改成客户端脚本ClientScript.RegisterClientScriptBlock()?
[解决办法]
调试看看
[解决办法]
怎么搞什么复杂嵌套页面 ....
[解决办法]
帮顶!
[解决办法]
很不幸的告诉你,我按照你贴出来的代码建了页面,只弹出一次对话框....
难道你在忽悠大家??

热点排行