65.9K
CodeProject 正在变化。 阅读更多。
Home

Atlas“待办事项列表”示例(Microsoft AJAX 实现)

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.89/5 (4投票s)

2006年11月27日

CPOL

1分钟阅读

viewsIcon

30996

启用可编辑网格,无需任何页面重新加载(仅由 Atlas 提供支持的部分重新加载)。

Sample Image - Tasks.jpg

引言

本文档介绍了如何启用可编辑网格,无需任何页面重新加载(仅由 Atlas 提供支持的部分重新加载)。

说明

重要提示:这是一个将 Atlas 应用到已经工作的可编辑网格的示例。

  1. 获取 Atlas 并安装它。
  2. 在您的项目中,将 Atlas DLL 添加到 Bin 目录。
  3. 将 Atlas 配置文件代码添加到应用程序的 web.config 文件中(在 VS 中,安装 Atlas 后,您还可以在“我的模板”下找到一个“ATLAS”网站模板,因此您可以创建一个新的“ATLAS”网站并从那里复制必要的配置)。
  4. 将 Atlas ScriptManager 对象添加到页面。
  5. 将您的网格包含在 Atlas UpdatePanel 中。
  6. 现在您可以享受了,因为您已经完成了!

(步骤 2) 将 ATLAS 配置文件代码添加到应用程序的 web.config

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <!-- 
        The configSections define a section for ASP.NET Atlas.
  -->
    <configSections>
        <sectionGroup name="microsoft.web" 
                type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
            <section name="converters" 
                type="Microsoft.Web.Configuration.ConvertersSection" 
                requirePermission="false"/>
            <section name="webServices" 
                type="Microsoft.Web.Configuration.WebServicesSection" 
                requirePermission="false"/>
            <section name="authenticationService" 
                type="Microsoft.Web.Configuration.AuthenticationServiceSection" 
                requirePermission="false"/>
            <section name="profileService" 
                type="Microsoft.Web.Configuration.ProfileServiceSection" 
                requirePermission="false"/>
        </sectionGroup>
  </configSections>

  <!-- 
      The microsoft.web section defines items required for the Atlas framework.
  -->
    <microsoft.web>
        <converters>
            <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
            <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
            <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
        </converters>
        <webServices enableBrowserAccess="true"/>
    </microsoft.web>
    <system.web>
        <pages>
            <controls>
                <add namespace="Microsoft.Web.UI" 
                   assembly="Microsoft.Web.Atlas" 
                   tagPrefix="atlas"/>
                <add namespace="Microsoft.Web.UI.Controls" 
                   assembly="Microsoft.Web.Atlas" 
                   tagPrefix="atlas"/>
            </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="true" defaultLanguage="c#">
            <buildProviders>
                <add extension=".asbx" 
                   type="Microsoft.Web.Services.BridgeBuildProvider"/>
            </buildProviders>
        </compilation>
        <httpHandlers>
            <!--
          ASMX is mapped to a new handler so that proxy javascripts can also be served.
      -->
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" 
               type="Microsoft.Web.Services.ScriptHandlerFactory" 
               validate="false"/>
            <!--
          The MultiRequestHandler enables multiple requests to be handled in one
          roundtrip to the server. Its use requires Full Trust.
      -->
            <add verb="*" path="atlasbatchcall.axd" 
              type="Microsoft.Web.Services.MultiRequestHandler" 
              validate="false"/>
            <add verb="*" path="atlasglob.axd" 
              type="Microsoft.Web.Globalization.GlobalizationHandler" 
              validate="false"/>
            <!--
          The IFrameHandler enables a limited form 
          of cross-domain calls to 'Atlas' web services.
          This should only be enabled if you need this 
          functionality and you're willing to expose
          the data publicly on the Internet.
          To use it, you will also need to add the attribute 
          [WebOperation(true, ResponseFormatMode.Json, true)]
          on the methods that you want to be called cross-domain.
          This attribute is by default on any DataService's GetData method.
          
      <add verb="*" path="iframecall.axd" 
         type="Microsoft.Web.Services.IFrameHandler" 
         validate="false"/>
      -->
            <add verb="*" path="*.asbx" 
              type="Microsoft.Web.Services.ScriptHandlerFactory" 
              validate="false"/>
        </httpHandlers>
        <httpModules>
            <add name="ScriptModule" 
               type="Microsoft.Web.Services.ScriptModule"/>
            <add name="BridgeModule" 
               type="Microsoft.Web.Services.BridgeModule"/>
            <add name="WebResourceCompression" 
               type="Microsoft.Web.Services.WebResourceCompressionModule"/>
        </httpModules>
  </system.web>
</configuration>

(步骤 3) 在您页面主内容中添加 Atlas ScriptManager

<ATLAS:SCRIPTMANAGER id=s1 runat="server" 
      EnablePartialRendering="true"></ATLAS:SCRIPTMANAGER>

(步骤 4) 将您的网格包含在 Atlas UpdatePanel 中

<atlas:UpdatePanel ID="p2" Mode="Conditional" runat="server">
    <ContentTemplate>
    GRID CODE HERE...
    </ContentTemplate>
</atlas:UpdatePanel>
<A href="http://www.spilafis.com.ar">http://www.spilafis.com.ar</A>

在此处查看一个可用的示例:http://spilafis.com.ar/Tasks.aspx

或在此处查看更多代码示例:http://spilafis.com.ar/CodeExamples.aspx

许可和免责声明

此页面中提供的所有说明、代码、HTML 以及所有内容均按“原样”提供,不提供任何形式的保证。您使用此软件的唯一条件是,您在页面的 HTML 中保留指向 http://www.spilafis.com.ar 的链接,如提供的页面所示。请支持免费软件,保留链接。

© . All rights reserved.