目前参加项目是从去年开始的,去年用的ATLAS做了一些东西,今天上面要求升级为AJAX 1.0的版本。
先从微软网站下载了ASP.NET AJAX 1.0(版本号:1.0.61025.0) 以及 3月2日发布的 AjaxControlToolkit (版本号:1.0.10301.0)
接下来就是安装。
先从控制面板卸载以前安装的ATLAS,再执行ASPAJAXExtSetup.msi进行安装,安装过程一切顺利。
工具栏中选择项目的方式先把AjaxControlToolkit那一套东东更新了,准备用确认按钮测试一下。
新建了一个ASP.NET AJAX-Enabled Web Site项目,页面已经自动添加了一个ScriptManager,拖入了一个UpdatePanel,放入一个按钮,再拖了一个ConfirmButtonExtender放在按钮旁边,关联上按钮,写入确认的文本,运行网站。
程序报错:
The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
我怀疑自己的眼睛,ScriptManager 不是已经在页面上了吗?难道'UpdatePanel1'对他视而不见。
出问题的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>


<%@ Register Assembly="Microsoft.Web.Atlas" Namespace="Microsoft.Web.UI" TagPrefix="cc1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<cc1:ScriptManager ID="ScriptManager1" runat="server">
</cc1:ScriptManager>
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:Label ID="Label1" runat="server" Text="Label" Width="346px"></asp:Label>
<cc2:ConfirmButtonExtender ID="ConfirmButtonExtender1" TargetControlID="Button1" ConfirmText="hekui,确认删除?" runat="server">
</cc2:ConfirmButtonExtender>
</ContentTemplate>
</cc1:UpdatePanel>
</form>
</body>
</html>
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%>


<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2"
%>

<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
Untitled Page
</
title
>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
asp:ScriptManager
ID
="ScriptManager1"
runat
="server"
>
</
asp:ScriptManager
>
<
asp:UpdatePanel
ID
="UpdatePanel1"
runat
="server"
>
<
ContentTemplate
>
<
asp:Button
ID
="Button1"
runat
="server"
OnClick
="Button1_Click"
Text
="Button"
/>
<
asp:Label
ID
="Label1"
runat
="server"
Text
="Label"
Width
="346px"
></
asp:Label
>
<
cc2:ConfirmButtonExtender
ID
="ConfirmButtonExtender1"
TargetControlID
="Button1"
ConfirmText
="hekui,确认删除?"
runat
="server"
>
</
cc2:ConfirmButtonExtender
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
form
>
</
body
>
</
html
>
先从微软网站下载了ASP.NET AJAX 1.0(版本号:1.0.61025.0) 以及 3月2日发布的 AjaxControlToolkit (版本号:1.0.10301.0)
接下来就是安装。
先从控制面板卸载以前安装的ATLAS,再执行ASPAJAXExtSetup.msi进行安装,安装过程一切顺利。
工具栏中选择项目的方式先把AjaxControlToolkit那一套东东更新了,准备用确认按钮测试一下。
新建了一个ASP.NET AJAX-Enabled Web Site项目,页面已经自动添加了一个ScriptManager,拖入了一个UpdatePanel,放入一个按钮,再拖了一个ConfirmButtonExtender放在按钮旁边,关联上按钮,写入确认的文本,运行网站。
程序报错:
The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
我怀疑自己的眼睛,ScriptManager 不是已经在页面上了吗?难道'UpdatePanel1'对他视而不见。
出问题的代码:
































又检查了一遍代码,发现页面顶上的声明好像有问题:怎么还会出现ATLAS的字样。再检查项目引用,果然还有一个Microsoft.Web.Atlas.dll在,遂删除,并重新添加最新的ajax扩展的三个dll到项目(文件:AJAXExtensionsToolbox.dll、System.Web.Extensions.dll、System.Web.Extensions.Design.dll 所处路径:C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025)
工具栏上再把Microsoft.Web.Atlas的选项去掉,重新添加AJAXExtensionsToolbox.dll的选项。再次放入ScriptManager、UpdatePanel,再次执行程序,一切正常了。耶~~~
改正后的代码:






























