拥抱ASP.NET AJAX 1.0 正式版

本文介绍如何在ASP.NET项目中配置并使用微软的AJAX 1.0正式版,包括所需DLL文件的放置位置、web.config文件的具体配置细节及一个使用Tabs控件的示例。

微软的ajax1.0正式版终于千呼万唤出来了,许多的微软的技术爱好者,又投入了研究过程中,体会他的研究乐趣。

下载地址:http://ajax.asp.net/

例子:http://ajax.asp.net/ajaxtoolkit/

建立一个ajax工程。

1,将AJAXExtensionsToolbox.dll,System.Web.Extensions.Design.dll,System.Web.Extensions.dll,三个文件放在工程的bin文件下面

2,在web.config中写入

 

<?xml version="1.0"?>
<configuration>
  
<configSections>
    
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
          
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
          
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
        
</sectionGroup>
      
</sectionGroup>
    
</sectionGroup>
  
</configSections>

  
<system.web>
    
<pages>
      
<controls>
        
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
</controls>
    
</pages>
    
<!--
          Set compilation debug="true" to insert debugging
          symbols into the compiled page. Because this
          affects performance, set this value to true only
          during development.
    
-->
    
<compilation debug="false">
      
<assemblies>
        
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
</assemblies>
    
</compilation>

    
<httpHandlers>
      
<remove verb="*" path="*.asmx"/>
      
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    
</httpHandlers>

    
<httpModules>
      
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    
</httpModules>
  
</system.web>

  
<system.web.extensions>
    
<scripting>
      
<webServices>
      
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
      
<!--
      <jsonSerialization maxJsonLength="500">
        <converters>
          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
        </converters>
      </jsonSerialization>
      
-->
      
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
      
<!--
        <authenticationService enabled="true" requireSSL = "true|false"/>
      
-->

      
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
           writeAccessProperties attributes. 
-->
      
<!--
      <profileService enabled="true"
                      readAccessProperties="propertyname1,propertyname2"
                      writeAccessProperties="propertyname1,propertyname2" />
      
-->
      
</webServices>
      
<!--
      <scriptResourceHandler enableCompression="true" enableCaching="true" />
      
-->
    
</scripting>
  
</system.web.extensions>

  
<system.webServer>
    
<validation validateIntegratedModeConfiguration="false"/>
    
<modules>
      
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    
</modules>
    
<handlers>
      
<remove name="WebServiceHandlerFactory-Integrated" />
      
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
           type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
           type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    
</handlers>
  
</system.webServer>
</configuration>

3,由于我比较喜欢Tabs,“http://ajax.asp.net/ajaxtoolkit/Tabs/Tabs.aspx"这种效果,所以就模仿制作了一个。

 

<%...@ Register
    Assembly
="AjaxControlToolkit"
    Namespace
="AjaxControlToolkit"
    TagPrefix
="ajaxToolkit" 
%>
<!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>ajax学习</title>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
    
        
<asp:ScriptManager ID="ScriptManager1" runat="server">
        
</asp:ScriptManager>
       
<ajaxToolkit:TabContainer runat=server ID="myshows"> 
       
<ajaxToolkit:TabPanel runat=server ID="news" HeaderText="新闻">
       
<ContentTemplate>
           
<img src="img/03.jpg" />
       
</ContentTemplate>
       
</ajaxToolkit:TabPanel>
       
<ajaxToolkit:TabPanel runat=server ID="yule" HeaderText="娱乐">
       
<ContentTemplate>
           
<img src="img/07.jpg" />
       
</ContentTemplate>
       
</ajaxToolkit:TabPanel>
        
<ajaxToolkit:TabPanel runat=server ID="TabPanel1" HeaderText="旅游">
       
<ContentTemplate>
           
<img src="img/P1010032.JPG" />
       
</ContentTemplate>
       
</ajaxToolkit:TabPanel>
        
<ajaxToolkit:TabPanel runat=server ID="TabPanel2" HeaderText="神奇">
       
<ContentTemplate>
           
<img src="img/P1010033.JPG" />
       
</ContentTemplate>
       
</ajaxToolkit:TabPanel>
        
<ajaxToolkit:TabPanel runat=server ID="TabPanel3" HeaderText="探险">
       
<ContentTemplate>
           
<img src="img/P1010034.JPG" />
       
</ContentTemplate>
       
</ajaxToolkit:TabPanel>
       
</ajaxToolkit:TabContainer>
    
</div>
    
</form>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值