Monday, November 27, 2006

Migration from Atlas July CTP to ASP.NET Ajax Beta 2

I am developing an application which does not really make use of Atlas controls but has a significant amount of Atlas scripting code to migrate.

I am not found of declarative scripting but maybe I am old-fashioned: I like to step through my code to debug it. My opinion is that declarative scripting is only good as the output of code-generation tools. It is not something that developers should write in a text editor.

So, I have got script to migrate and I have read the documentation available at:

Downloading and installing ASP.NET Ajax Beta 2 is well explained in the documentation but I had to do a bit of guessing as well as exploring Microsoft’s code to migrate my own code. I deliver my findings below:

Migrating client script

  1. To use client scripting of html components, you need to add a reference to PreviewScript.js in your ScriptManager as shown below:

<asp:ScriptManager ID="ScriptManager" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Microsoft.Web.Preview"
Name="Microsoft.Web.Resources.ScriptLibrary.PreviewScript.js"/>
</Scripts>
</asp:ScriptManager>

  1. $(id) is now $get(id)

  2. The Sys.UI namespace is now Sys.Preview.UI

  3. Sys.UI.Select is now Sys.Preview.UI.Selector

  4. Sys.UI.CheckBox.click.add(handler) is now Sys.UI.Preview.CheckBox.add_click(handler)

  5. Sys.UI.Select.selectionChanged.add(handler) is now Sys.Preview.UI.Selector.add_selectionChanged(handler)

  6. $addHandler/$removeHandler is the new way to add event handlers

  7. Sys.UI.Control.get_enabled() and set_enabled() no more work

Migrating web service calls

  1. You need to decorate your web services and page methods with new attributes as explained in http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx.

  2. The prototype of asynchronous calls to web services and page methods has been simplified, but this is well explained in the documentation listed above.

1 comment:

Macrosoft said...

Thanks for sharing the migration information.

ASP.Net Migration