LA.NET [EN]

Nov 23

In the last week, MS AJAX beta was released during PDC 2009. One of the things that this released added is ACT script loader support. If you go into the samples, you’ll see that there is an Extended folder which holds all the client files for the behaviors and controls exposed by the AjaxControlToolkit.

extended

The code files have all been updated so that its” definitions are wrapped into an execute function (which is also placed inside an anonymous function). As you probably recall from previous posts, this function is called when all the dependencies have been loaded. Notice that  with the previous CTP you could download the ACT from codeplex and make the changes present in all the files that come with this release. In other words, wrapping all the code within functions is the easiest part when you want to adapt an existing script so that it can be used with the new script loader component.

To me, the most important script file is the ExtendedControl Javascript file because it contains all the definitions (and dependencies) required by all the ACT controls. In practice, this means that you can simply drop this file on a page (plus the base start.js Javascript file) and use any of the ACT controls. Don’t believe me? Here’s some demo code which uses the calendar behavior:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <link rel="stylesheet" type="text/css"
   href=
"Scripts/MicrosoftAjax/Extended/Calendar/Calendar.css" /> <script type="text/javascript" src="Scripts/MicrosoftAjax/Start.debug.js"></script> <script type="text/javascript" src="Scripts/MicrosoftAjax/Extended/ExtendedControls.debug.js"></script> <script type="text/javascript"> Sys.require([Sys.components.calendar], function () { Sys.create.calendar(Sys.get("#date")); }); </script> </head> <body> <input type="text" id="date" /> </body> </html>

And that’s it: I’ve just added two scripts and that’s all I needed to use the CalendarBehavior. Btw, here’s the results I got on my machine after loading the page:

calendar

Nice, right?

1 comment so far

  1. egbydmnp
    1:10 am - 12-13-2009

    eRmLS4 ywdvdtovdbex, [url=http://wzbbkkmzjbia.com/]wzbbkkmzjbia[/url], [link=http://ukxelpfzitdm.com/]ukxelpfzitdm[/link], http://tbhazqmbpmyq.com/