【发布时间】:2011-09-22 21:07:28
【问题描述】:
我有一个非常简单的 ASP.NET 项目。它由两页组成。
第一页 (FirstPage.htm) 有以下标记:
<!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>
<script type="text/javascript">
function test() {
window.showModalDialog('PageTwo.aspx', '', '');
};
</script>
</head>
<body>
<a href="#" onclick="test();">Test Window</a>
</body>
</html>
第二页(PageTwo.aspx)有这个作为标记:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="PageTwo.aspx.vb" Inherits="MyEmptyWebApp.PageTwo" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button 1" />
</div>
<asp:Button ID="Button2" runat="server" Text="Button 2" />
</form>
</body>
</html>
这就是 CodeBehind:
Public Class PageTwo
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
所以第一页有一个超链接,可以在弹出窗口中加载第二页。
第 2 页有一个按钮,应该什么都不做。但是,当我单击按钮时,会弹出一个新窗口并再次加载第 2 页。
如果我直接导航到第 2 页,什么都不会发生。
我想我必须在 VS 或 IIS 中有一些奇怪的配置导致它;但我不知道是什么。
解决方法是here如果你想下载看看。
【问题讨论】:
标签: javascript asp.net html vb.net