按照http://hi.baidu.com/yuye3618447378/blog/item/8972edfaf5fdb76d034f56f3.html上的代码做的网页,不报错,VS已经安装了AjaxControlToolkit,在左边的工具箱里建立了AjaxControlToolkit选项卡。但是Mathon运行之后,页面点击“LinkButton1”没有弹出窗口,怎么解决?多谢!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="page2.aspx.cs" Inherits="page2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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>Untitled Page</title>
<script type="text/javascript">
var styleToSelect;
function onOk()
{
document.getElementById("Parageraph1").className = styleToSelect;
}
</script>
<style type="text/css">
.modalBackground //设置背景样式
{
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup //设置panel样式
{
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
.sampleStyleA
{
background-color:#FFF;
}
.sampleStyleB
{
background-color:#FFF;
font-family:monospace;
font-size:10pt;
font-weight:bold;
}
.sampleStyleC
{
background-color:#ddffdd;
font-family:sans-serif;
font-size:10pt;
font-style:italic;
}
.sampleStyleD
{
background-color:Blue;
color:White;
font-family:Arial;
font-size:10pt;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<p>
<a href="#Panel1">请点击这里变换文本</a>
</p>
<p id="Paragraph1">
今天天气不错挺风和日丽的<br />
我们下午没有课这天气挺爽的 <br />
我一大中午早早的跑去上自习心里啄么着大学生活是多么美好啊 ……<BR>
<asp:Button ID="LinkButton1" runat="server" Text="单击" />
</p>
<asp:Panel ID="Panel1" runat="server" Style="display: none">
<asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" Width="309px">
<div>
<p>请选择页面风格:</p>
<p><input type="radio" name="Radio" id="RadioA" checked="checked" οnclick="styleToSelect = 'sampleStyleA';" />
<label for="RadioA" class="sampleStyleA" style="padding: 3px;">风格样式一</label>
</p>
<p><input type="radio" name="Radio" id="RadioB" οnclick="styleToSelect = 'sampleStyleB';" />
<label for="RadioB" class="sampleStyleB" style="padding: 3px;">风格样式二</label>
</p>
<p>
<input type="radio" name="Radio" id="RadioC" οnclick="styleToSelect = 'sampleStyleC';" />
<label for="RadioC" class="sampleStyleC" style="padding: 3px;">风格样式三</label>
</p>
<p>
<input type="radio" name="Radio" id="RadioD" οnclick="styleToSelect = 'sampleStyleD';" />
<label for="RadioD" class="sampleStyleD" style="padding: 3px;">风格样式四</label>
</p>
<p>
<label class="sampleStyleD" for="RadioD" style="padding-right: 3px; padding-left: 3px;padding-bottom: 3px; padding-top: 3px">
<span style="font-size: 12pt">
<span style="">
<span style="color: #000000">
</span>
</span>
</span>
</label>
<asp:Button ID="OkButton" runat="server" Text="确定" />
<asp:Button ID="CancelButton" runat="server" Text="取消" />
</p>
</div>
</asp:Panel>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="LinkButton1" PopupControlID="Panel1" BackgroundCssClass="modalBackground" OkControlID="OkButton" OnOkScript="onOk()" CancelControlID="CancelButton" DropShadow="true" Drag="true" PopupDragHandleControlID="Panel2">
</asp:ModalPopupExtender>
</div>
</form>
</body>
</html>