Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / XHTML

Atlas 'To Do List' sample (Microsoft AJAX implementation)

1.89/5 (4 votes)
27 Nov 2006CPOL1 min read 2  
Enable an editable grid to update without any page reloads (just partial reloads powered by Atlas).

Sample Image - Tasks.jpg

Introduction

This article explains how to enable an editable grid to update without any page reloads (just partial reloads powered by Atlas).

Instructions

Important note: This is an example of applying Atlas to an already working editable grid.

  1. Get Atlas and install it.
  2. In your project, add the Atlas DLL to the Bin directory.
  3. Add the Atlas config code to the application's web.config (in VS, after installing Atlas, you can also find an "ATLAS" Web Site template under My Templates, so you may create a new "ATLAS" Web Site and copy the necessary configuration from there).
  4. Add the Atlas ScriptManager object to the page.
  5. Enclose your grid inside an Atlas UpdatePanel.
  6. And enjoy, because you are done!

(Step 2) Add the ATLAS config code to the application's web.config

XML
<?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>

(Step 3) Add the Atlas ScriptManager inside your page's main content

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

(Step 4) Enclose your grid inside an Atlas UpdatePanel

HTML
<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>

See a working example here: http://spilafis.com.ar/Tasks.aspx.

Or more code samples at: http://spilafis.com.ar/CodeExamples.aspx.

License and Disclaimer

All the instructions, code, HTML, and everything presented in this page is provided 'as is' with no warranties what so ever. The only condition for you to use this software is that you keep the link to http://www.spilafis.com.ar in the HTML of the page as provided. Please support freeware, keeping the link.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)