我已经研究了好几天了!我只是想在后面的 VB 代码中获取一个事件来显示一个 jQuery 对话框(带有合适的消息)。
我的(非常简单的)HTML:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ButtonMustWork.aspx.vb" Inherits="NowDisplayPictures.ButtonMustWork" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
function GetDialogBox() {
$("#dialog").dialog();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
和我的VB按钮点击事件:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
ClientScript.RegisterStartupScript(Me.[GetType](), "Test", "<script>GetDialog();</script>")
End Sub
我得到的只是一个空白页,上面有文字,还有一个按钮。请问有什么想法吗?