我有A,B两个页面,A页的Iframe有个GrideView,点击某一行的打开B页面,B的后台接收参数读出详细数据,点击“确定”后,(aspbutton)后台代码"Response.Write("<script>alert(已成功修改');</script>");",问题:1.alert不弹出;
     2.关闭之后GrideView怎么刷新

解决方案 »

  1.   

    你可以在B页面关闭了在重新跳转到A页面撒!至于你的alert弹不出要看你的全不代码了  在ASP.ENT中如果你用的ajax的无刷新技术这种方式就会弹不出来!
      

  2.   

    response.write("<script>window.openner.location.href=window.openner.location.href</script>")
    刷新负页面
    Page.RegisteraStartupScript(this,this.GetType(),"alert","alert(已成功修改');")
      

  3.   

    你的B页面是不是有UpdatePanel啊?
    另外以后记得在后台输出脚本不要再用Response.Write了
    参考:
    如果有UpdatePanel:ScriptManager.RegisterStartupScript(this,typeof(string),"success","alert('修改成功');window.opener.location.href = window.opener.location.href;", true);如果没有ClientScript.RegisterStartupScript(typeof(string),"success","alert('修改成功');window.opener.location.href = window.opener.location.href;", true);
      

  4.   

    还要请教一个问题,为什么我的项目运行起来,App_Data文件夹中多个了ASPNETDB数据库,这是怎么回事,请解答
      

  5.   

    Response.Write("<script>window.open('about:blank','_self');window.close();window.opener.location.reload();</script>");
      

  6.   

    你是不是使用了asp.net自带的form验证啊?
      

  7.   

    不是验证控件,换个问法吧,是否在网站中使用了Login登录控件?
      

  8.   

    没有呀,我就有几个控件验证了必填,<table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse">
                        <tr>
                            <td>
                                <table border="0" cellpadding="0">
                                    <tr>
                                        <td align="center" colspan="2">
                                            更改密码</td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="width: 132px">
                                            <asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword">密&nbsp;&nbsp;&nbsp;码:</asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password" Width="161px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword" Display="Dynamic" ErrorMessage="必须填写“密码”。">*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="width: 132px">
                                            <asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">新密码:</asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="NewPassword" runat="server" TextMode="Password" Width="161px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword"
                                                ErrorMessage="必须填写“新密码”。" ToolTip="必须填写“新密码”。" >*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="width: 132px">
                                            <asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">确认新密码:</asp:Label></td>
                                        <td>
                                            <asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password" Width="161px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
                                                ErrorMessage="必须填写“确认新密码”。" ToolTip="必须填写“确认新密码”。" >*</asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" colspan="2">
                                            <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword"
                                                ControlToValidate="ConfirmNewPassword" Display="Dynamic" ErrorMessage="“确认新密码”与“新密码”项必须匹配。"
                                                ></asp:CompareValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" style="width: 132px">
                                            <asp:Button ID="ChangePasswordPushButton" runat="server" onclick="ChangePassword"  Text="更改密码"  />
                                        </td>
                                        <td>
                                            <asp:Button ID="CancelPushButton" runat="server"  onclick="Cancel"  Text="取消" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>我点确定,他验证控件的必填,怎么我点取消,也验证呀,怎么把取消验去掉!!请教“天行健”
      

  9.   

    Response.Write(" <script>alert(已成功修改'); </script>"); 
    这句话改成
    Response.Write(" <script>alert(已成功修改'); location="A 页面";</script>"); 
    这样就会重新加载A页面,gridview也就刷新了
    至于为什么不弹出,1.你写的代码有问题,没执行到  这句话,就不执行了,或跳过去了。
     2.你用了ajax 
      

  10.   

    为控件指定ValidationGroup就可以了,参考:        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ControlToValidate="TextBox1"
                ID="RequiredFieldValidator1" runat="server" ErrorMessage="Not Empty" ValidationGroup="Val1"></asp:RequiredFieldValidator>
            <asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="Val1" />
            <asp:Button ID="Button2" runat="server" Text="Button" />