Atlas Declarative markup

Atlas has 3 main ways of specifying functionality and behaviours. Imperative (via std javascript which most people would be familiar with, particularly those with AJAX.NET experience), declaratively, and through server controls. Previous posts have dealt mostly with the imperative method, however this post will transition somewhat into the delcarative.

Take a look at the code fragment below which simply has a button, which will invoke a 'GetCustomer' web service asynchronously, and display the results:

<script type="text/xml-script">
        <page xmlns:script="">
                <!-- Repath the following src attributes, using regular client relative paths as necessary -->
                <add src="ScriptLibrary/AtlasUI.js" />
                <add src="ScriptLibrary/AtlasControls.js" />
                <serviceMethod id="custService"
                      url="MyService.asmx" methodName="GetCustomer">
                            <invokeMethod target="serviceBinding" method="evaluateIn" />
                <textBox id="txtResults">
                    <binding id="serviceBinding" property="text"
                      automatic="false" />
                <button id="btnGet">
                        <invokeMethod target="custService" method="invoke" />

This represents an Atlas declarative markup section. Atlas interprets this markup, and emits the necessary code to 'hookup' the relevent onclick event of the 'btnGet' button, call the webservice (specifically the 'GetCustomer' webmethod) defined in the <serviceMethod> and display those results in the <textbox>. The HTML code would simply look like:

<input id="btnGet" type="button" value="Get a Customer" /><br />
<label id="lbl1">Results:</label><br />
<input id="txtResults" type="text" /><br />

Notice that the 'txtResults' input box is linked to the <textbox> Atlas declarative markup via its ID attribute, and similarly with the 'btnGet' input button and associated Atlas markup.

Currently, all this must be handcoded, however designer support around this declarative model is forthcoming. You will also notice that to achieve the same functionality imperatively (using simple javascript) actually takes a lot less code. While this is true for simple scenarios, the more complex it gets, and the more difficult it will be to write imperatively. This is where the declarative model will be very useful. Obviously, usage of Atlas server controls is another option, but for now, lets stick with the imperative and declarative.

The declarative model has a plethora of options and things to play with, which I will attempt to address in future posts and at this early stage of Atlas, also comes with a few issues, one of which I may detail in my next post. Stay tuned....


  • why didn't you use the &quot;~/ScriptLibrary/AtlasUI.js&quot; inside the references add src ?

  • I simply accepted the defaults from a new page/project creation and to be honest, I didn't think anyone would pick up on it. :-)

    Good catch though, I suspect that the relative paths will be included as the default rather than simply stuffing a comment in there for you to do so. I think the majority of developers will want to change it to the relative path (ie. using '~'), well at least I almost always would. For the super simple example, it wasn't an issue.

Comments have been disabled for this content.