问题:
1、设置a.aspx为起始页,进入debug模式,在a.aspx页面中点击“OPEN”按钮,在弹出的b.aspx页面中更换下拉列表的选择项后会弹出一个警告框:“htmlfile:不支持此接口”。
   此时visual studio在以下代码的“theForm.submit();”那一行暂停执行了:
   var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();     // 在此行暂停执行了
    }
}2、另外,从a.aspx页面进入b.aspx页面后,点击按钮“Button2”时没有反应,没有执行方法Button2_Click(object sender, EventArgs e), 也没有在b.aspx.cs的断点处暂停。但是,如果起始页是b.aspx,直接打开b.aspx的话,该断点是会生效的。
环境:
visual studio 2008, windows xp sp3, IE7测试代码:
a.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="a.aspx.cs" Inherits="a" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script language="javascript " type="text/javascript">
function Button1_onclick(){
var st=window.showModalDialog('b.aspx?val='+document.all["TextBox1"].value);
document.all["TextBox1"].value=st;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<input id="Button1" type="button" value="OPEN" onclick="return Button1_onclick()" />
</div>
</form>
</body>
</html>
b.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="b.aspx.cs" Inherits="b" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title> <script language="javascript" type="text/javascript">
function  Button1_onclick()   {
window.returnValue=document.all["TextBox1"].value;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<input id="Button1" type="button" value="OK " onclick="return Button1_onclick()" />
<br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem Selected="True">a</asp:ListItem>
<asp:ListItem>b</asp:ListItem>
<asp:ListItem>c</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Button2" />
<br />

</div>
</form>
</body>
</html>
b.aspx.cs:
protected void Button2_Click(object sender, EventArgs e) {
string a = "";  // 此行设置一个断点
// 处理操作...
}
请懂的朋友帮忙看看啊,谢谢了!!

解决方案 »

  1.   

    直接打开b.aspx的话,DropDownList1的“AutoPostBack”动作是可以正常执行的,但在以showModalDialog弹出窗口中就报错了:“htmlfile:不支持此接口”
      

  2.   

    A modal dialog box retains the input focus while open. The user cannot switch windows until the dialog box is closed.http://msdn.microsoft.com/zh-cn/library/ms536759(v=VS.85).aspx你的问题可以参考以下解决
    http://dev.csdn.net/htmls/27/27760.html
      

  3.   

     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="false">
                <asp:ListItem Selected="True" value="a">a</asp:ListItem>
                <asp:ListItem  value="b">b</asp:ListItem>
                <asp:ListItem  value="c">c</asp:ListItem>
            </asp:DropDownList>
    document.getElementById("<%= TextBox1.ClientID%>")
      var f = function(){
            var obj = document.getElementById("txt");
            var str =window.showModalDialog("b.aspx",obj,"dialogWidth=300px;dialogHeight=200px");    }    var obj = window.dialogArguments;
        var Button1_onclick = function(){
          obj.value = "";
        }
       <input type="button" value="Button1" onclick="Button1_onclick();" />