Friday, May 04, 2007 3:40 PM
DmitryR
Dynamic Client Script
Attached to this post is the Dynamic Client Script sample -- an ASP.NET control that simplifies creation of AJAX-like Web pages in managed scripting languages using Microsoft Silverlight cross-browser / cross-platform technologies.
The recent release of Microsoft Silverlight enables a set of scenarios that some people might find interesting. Silverlight 1.1 Alpha release includes features that enable AJAX-like scenarios using managed dynamic languages on the client:
- APIs to access HTML DOM from managed code
- APIs to make HTTP requests to Web services from managed code
- Dynamic Language Runtime (DLR) with the implementation of IronPython and Managed JScript (with more dynamic languages, including IronRuby, coming in the future). (Please also see Dynamic Silverlight Samples on CodePlex)
As a result, it is possible to author an HTML page with IronPython client script using the following steps:
- Start with an HTML page
- Write the IronPython client script file
- Author a [bootstrapping] XAML file with a reference to the IronPython client script file (and add the XAML file to the project)
- Add a link in the HTML page to the Silverlight bootstrapping jscript files (and add the files to the project)
- Add jscript code to the HTML page to instantiate the Silverlight control
Dynamic Client Script control dramatically simplifies this:
- Start with an ASP.NET page
- Write the IronPython client script file
- Place Dynamic Client Script control onto the ASP.NET page and set 'Source' property to point to the IronPython file
Notes:
- Dynamic Client Script control automatically renders the links to the bootstrapping jscript and to XAML (the actual links point back to the containing page and the control intercepts these requests and serves the corresponding content)
- No additional files need to be added to the project
- Several Dynamic Client Script controls can co-exist in the same ASP.NET page
- Dynamic Client Script control (in addition to 'Source' reference) supports inline script (it uses the same link-back trick to generate the link from XAML to script)
The attached package (DynamicClientScript.zip) contains sources (licensed under Ms-PL) and samples (as a run-able Web app).
Please check this out, if you are interested.