<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tales from the Evil Empire : OpenAjax</title><link>http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx</link><description>Tags: OpenAjax</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Going to California</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/22/going-to-california.aspx</link><pubDate>Wed, 22 Oct 2008 19:25:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6698142</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=6698142</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2008/10/22/going-to-california.aspx#comments</comments><description>&lt;p&gt;I’m flying to San Jose tonight for tomorrow’s &lt;a href="http://www.openajax.org/member/wiki/2008_October_Members_Meeting"&gt;OpenAjax Alliance face to face meeting&lt;/a&gt;, which Microsoft is hosting. On Friday, we are also hosting a new event that aims at establishing a dialogue between JavaScript library developers and Microsoft. We’ll have talks from the IE, Visual Studio and ASP.NET teams, as well as talks from members of the community. This should be very interesting.&lt;/p&gt;  &lt;p&gt;Then I’ll be flying to L.A. for the &lt;a href="http://www.microsoftpdc.com/"&gt;PDC&lt;/a&gt;. If you’re going to be there and want to chat, feel free to drop me a note at bleroy at Microsoft.&lt;/p&gt;  &lt;p&gt;I’ll be in the room during &lt;a href="http://weblogs.asp.net/stephenwalther/default.aspx"&gt;Stephen Walthers&lt;/a&gt;’ session on &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; and ASP.NET on Tuesday from 5:15 to 6:30 (403AB).&lt;/p&gt;  &lt;p&gt;I’ll also do a short demo in &lt;a href="http://blogs.msdn.com/scothu/default.aspx"&gt;Scott Hunter&lt;/a&gt;’s talk on the ASP.NET 4.0 Roadmap on Monday from 1:45 to 3:00 (153).&lt;/p&gt;  &lt;p&gt;Other sessions I’ll attend include &lt;a href="http://haacked.com/Default.aspx"&gt;Phil Haack&lt;/a&gt;’s MVC session (Monday, 3:30 in 153), Jeff King’s talk on Visual Studio Web Development Futures (Monday, 5:15 in 153), the panel talk on the future of programming languages (Wednesday 10:30 in 403AB), Frank Savage’s &lt;a href="http://blogs.msdn.com/xna/default.aspx"&gt;XNA&lt;/a&gt; Game Studio talk (Wednesday, 12:00 in 501B), &lt;a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg"&gt;Anders Heljsberg&lt;/a&gt;’s talk on C# (Wednesday 3:00 in 502A), &lt;a href="http://tirania.org/blog/"&gt;Miguel de Icaza&lt;/a&gt;’s talk on Mono (Wednesday at 4:45 in 515B) and of course &lt;a href="http://browse.barnesandnoble.com/booksearch/results.asp?ath=Stefan+Schackow"&gt;Stefan Schackow&lt;/a&gt;’s ASP.NET Cache Extensibility talk (Thursday 10:15 in 403B) which was the highest rated talk during our dry-run of the conference…&lt;/p&gt;  &lt;p&gt;And of course, I’ll be on stage for my own talk on &lt;a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=AJAX&amp;amp;referringTitle=Home"&gt;ASP.NET 4.0 AJAX&lt;/a&gt; on Thursday from 1:45 to 3:00 (Petree Hall CD), which will pretty much close the show. I’ll be building a small application using client templates, bindings, some &lt;a href="http://www.jquery.com/"&gt;jQuery&lt;/a&gt; and ADO.NET Data Services.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6698142" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/PDC/default.aspx">PDC</category></item><item><title>OpenAjax requests comments on browser wishlist</title><link>http://weblogs.asp.net/bleroy/archive/2008/04/01/openajax-requests-comments-on-browser-wishlist.aspx</link><pubDate>Tue, 01 Apr 2008 17:13:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6057153</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=6057153</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2008/04/01/openajax-requests-comments-on-browser-wishlist.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;The OpenAjax Alliance has been working with&amp;nbsp;some of the top Ajax developers&amp;nbsp;on a wishlist that aims at gathering and prioritizing the development features that we need the most from next generation browsers. The process is completely open and Wiki-based, so feel free to contribute.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;U&gt;&lt;FONT color=#800080&gt;&lt;A href="http://www.openajax.org/blogs/wp-trackback.php?p=53"&gt;http://www.openajax.org/blogs/wp-trackback.php?p=53&lt;/A&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;A href="http://www.openajax.org/blogs/?p=53" mce_href="http://www.openajax.org/blogs/?p=53"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6057153" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/HTML/default.aspx">HTML</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Safari/default.aspx">Safari</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Opera/default.aspx">Opera</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Internet+Explorer/default.aspx">Internet Explorer</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Firefox/default.aspx">Firefox</category></item><item><title>Microsoft now in the OpenAjax steering comittee</title><link>http://weblogs.asp.net/bleroy/archive/2007/10/09/microsoft-now-in-the-openajax-steering-comittee.aspx</link><pubDate>Tue, 09 Oct 2007 22:37:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4513323</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=4513323</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/10/09/microsoft-now-in-the-openajax-steering-comittee.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Thanks to all members who voted. I'm looking forward to working with the other members.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://www.openajax.org/blogs/?p=41"&gt;http://www.openajax.org/blogs/?p=41&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4513323" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft/default.aspx">Microsoft</category></item><item><title>OpenAjax InteropFest 1.0: Microsoft's entry</title><link>http://weblogs.asp.net/bleroy/archive/2007/09/21/openajax-interopfest-1-0-microsoft-s-entry.aspx</link><pubDate>Fri, 21 Sep 2007 19:21:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4015087</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=4015087</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/09/21/openajax-interopfest-1-0-microsoft-s-entry.aspx#comments</comments><description>&lt;P&gt;Yesterday I got to write our entry in &lt;A href="http://www.openajax.org/member/wiki/InteropFest_1.0" mce_href="http://www.openajax.org/member/wiki/InteropFest_1.0"&gt;OpenAjax's InteropFest&lt;/A&gt;. The goal of this event is to demonstrate how different Ajax libraries can be parts of the &lt;A href="http://www.openajax.org/" mce_href="http://www.openajax.org"&gt;OpenAjax&lt;/A&gt; ecosystem and interact with each other through the &lt;A href="http://www.openajax.org/member/wiki/OpenAjax_Hub" mce_href="http://www.openajax.org/member/wiki/OpenAjax_Hub"&gt;OpenAjax hub&lt;/A&gt;. The currently central feature of the hub is to expose &lt;A href="http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_PublishSubscribe" mce_href="http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_PublishSubscribe"&gt;a publish/subscribe message bus&lt;/A&gt; so that both producers and consumers of events can speak through a third party that is neutral to specific Ajax implementations.&lt;/P&gt;
&lt;P&gt;The &lt;A href="http://www.openajax.org/" mce_href="http://www.openajax.org"&gt;OpenAjax Alliance&lt;/A&gt; provides a template for demo applications that shows a live data source feeding fake stock quotes through the hub to a visual component that then renders them.&lt;/P&gt;
&lt;P&gt;I've chosen to modify the live data source to be a Microsoft Ajax-style component. The visual component would not have been as interesting because it's really the application that is a consumer of events. The visual component itself doesn't strictly speaking communicate with the hub, the application does (through a trivial API call) and then transmits the results to the component for rendering. In other words, the data source is a lot more interesting because it &lt;EM&gt;exposes&lt;/EM&gt; the event, and if it is a Microsoft Ajax component, it will use the Microsoft Ajax event pattern, which is quite different from the OpenAjax event pattern.&lt;/P&gt;
&lt;P&gt;I did refactor the consuming part of the application quite heavily, but that was more to understand it than anything and it's not the essential part of our entry.&lt;/P&gt;
&lt;P&gt;To achieve the mapping from Microsoft Ajax events to OpenAjax messages, I've written the following simple helper:&lt;/P&gt;&lt;PRE class=code&gt;Type.registerNamespace(&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"Sys.OpenAjax"&lt;/SPAN&gt;);

Sys.OpenAjax._Helper = &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;() {
}
Sys.OpenAjax._Helper.prototype = {
    mapEventToMessage:&lt;BR&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;(owner, eventName, messageName, publisherDataMapper) {&lt;BR&gt;            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;var&lt;/SPAN&gt; handler = &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;(sender, args) {
                OpenAjax.hub.publish(&lt;BR&gt;                    messageName,&lt;BR&gt;                    publisherDataMapper ?&lt;BR&gt;                        publisherDataMapper(sender, args) : &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;null&lt;/SPAN&gt;);
            }
            owner[&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"add_"&lt;/SPAN&gt; + eventName](handler);
            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;return&lt;/SPAN&gt; handler;
        },
    unmapEvent:&lt;BR&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;(owner, eventName, map) {
            owner[&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"remove_"&lt;/SPAN&gt; + eventName](map);
        }
}
Sys.OpenAjax._Helper.registerClass(&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"Sys.OpenAjax._Helper"&lt;/SPAN&gt;);

Sys.OpenAjax.Helper = &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;new&lt;/SPAN&gt; Sys.OpenAjax._Helper();&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The application code can use that new API to map the events of any Microsoft Ajax component to become publishers of OpenAjax messages without any necessity for the component to contain any code specific to OpenAjax, let alone know about it. In other words, the component implementation remains completely decoupled from OpenAjax and it's the application that makes the connection.&lt;/P&gt;
&lt;P&gt;The application maps the &lt;FONT face="Courier New"&gt;quoteChanged&lt;/FONT&gt; event to the &lt;FONT face="Courier New"&gt;org.openajax.interopfest10.datagen.stockpriceupdate&lt;/FONT&gt; OpenAjax message like this:&lt;/P&gt;&lt;PRE class=code&gt;Sys.OpenAjax.Helper.mapEventToMessage(
    corpList, &lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"quoteChanged"&lt;/SPAN&gt;,
    &lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"org.openajax.interopfest10.datagen.stockpriceupdate"&lt;/SPAN&gt;,
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt; (sender, args) {
        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;var&lt;/SPAN&gt; quote = args.get_quote();
        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;return&lt;/SPAN&gt; {
            tickerName: quote.symbol,
            corpName: quote.name,
            price: quote.price
        };
    }
);&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;From this moment on, all &lt;FONT face="Courier New"&gt;quoteChanged&lt;/FONT&gt; events will be published on the hub. An interesting thing to note is the use of an optional function that maps the Microsoft Ajax event argument to the expected OpenAjax data payload.&lt;/P&gt;
&lt;P&gt;Brad Abrams kindly hosts the demo on his personal website for the moment:&lt;BR&gt;&lt;A href="http://brad_abrams.members.winisp.net/Projects/OpenAjax/index.html" mce_href="http://brad_abrams.members.winisp.net/Projects/OpenAjax/index.html"&gt;http://brad_abrams.members.winisp.net/Projects/OpenAjax/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The source code can be downloaded by clicking &lt;A href="http://brad_abrams.members.winisp.net/Projects/OpenAjax/InteropFest_1_0_Microsoft_Sources_No_Library.zip" mce_href="http://brad_abrams.members.winisp.net/Projects/OpenAjax/InteropFest_1_0_Microsoft_Sources_No_Library.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4015087" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft/default.aspx">Microsoft</category></item><item><title>Microsoft Ajax events - part 2: exposing events from custom classes</title><link>http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx</link><pubDate>Wed, 23 May 2007 01:11:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2638346</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=2638346</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In &lt;A href="http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx" mce_href="http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx"&gt;part 1&lt;/A&gt;, I showed how to subscribe to events exposed by JavaScript classes built on Microsoft Ajax. In this post, I'll show how to expose new events from your own classes.&lt;/P&gt;
&lt;P&gt;Theoretically, the only things you have to do to expose an event are to implement "add_myEvent" and "remove_myEvent" methods that add or remove handlers, and to call all subscribers when relevant. In practice, managing the list of handlers for each event is really boilerplate code that you would have to reproduce for every event. This is why the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx"&gt;Sys.Component&lt;/A&gt; base class exposes an &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentEventsProperty.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentEventsProperty.aspx"&gt;events&lt;/A&gt; property that is an instance of &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventHandlerListClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventHandlerListClass/default.aspx"&gt;Sys.EventHandlerList&lt;/A&gt;, which makes the event handler management a lot easier, and also has a few performance advantages. This is not a new pattern, &lt;A href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.aspx"&gt;System.Web.UI.Control&lt;/A&gt; also has an &lt;A href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.events.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.events.aspx"&gt;Events property&lt;/A&gt; of type &lt;A href="http://msdn2.microsoft.com/en-us/library/system.componentmodel.eventhandlerlist.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.componentmodel.eventhandlerlist.aspx"&gt;System.ComponentModel.EventHandlerList&lt;/A&gt;, so if you know the .NET pattern you should&amp;nbsp;feel right at home.&lt;/P&gt;
&lt;P&gt;Let's look at a very simple example for which we'll build a very simple timer component. Our timer will expose a single event: tick&amp;nbsp;(in addition to the&amp;nbsp;events the base class supports, but we'll get back to that in a moment). The code for the add and remove event accessors is really simple, and this is all you have to do to expose any event:&lt;/P&gt;&lt;PRE class=code&gt;add_tick: &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;(handler) {
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;this&lt;/SPAN&gt;.get_events().addHandler(&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"tick"&lt;/SPAN&gt;, handler);
},
remove_tick: &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;(handler) {
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;this&lt;/SPAN&gt;.get_events().removeHandler(&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"tick"&lt;/SPAN&gt;, handler);
},&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The only thing that will vary in this code is the event name ("tick" here).&lt;/P&gt;
&lt;P&gt;Calling subscribers is done from the _tick private function of our Timer class:&lt;/P&gt;&lt;PRE class=code&gt;_tick: &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt;() {
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;var&lt;/SPAN&gt; handler = &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;this&lt;/SPAN&gt;.get_events().getHandler(&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;"tick"&lt;/SPAN&gt;);
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;if&lt;/SPAN&gt; (handler) handler(&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;this&lt;/SPAN&gt;, Sys.EventArgs.Empty);
    &lt;FONT color=#008000&gt;// [...]&lt;/FONT&gt;
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;What's important in this method is how the _tick function gets a unique function reference for the "tick" event that will forward the calls to all subscribers. This makes Ajax events similar to .NET's multicast events. The&amp;nbsp;function reference&amp;nbsp;that getHandler returns can be null (in the case there are no subscribers) so it's important to test it before using it, but calling&amp;nbsp;it is as simple as calling a regular function: the multicasting is entirely and internally&amp;nbsp;handled by &lt;A class="" href="http://ajax.asp.net/docs/ClientReference/Sys/EventHandlerListClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventHandlerListClass/default.aspx"&gt;Sys.EventHandlerList&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Note that this _tick&amp;nbsp;function is wired using window.setTimeout from the start method as can be seen in the &lt;A class="" href="http://weblogs.asp.net/blogs/bleroy/Samples/Timer.js.txt" mce_href="http://weblogs.asp.net/blogs/bleroy/Samples/Timer.js.txt"&gt;full source code&lt;/A&gt;. I also omitted the code that rewires the timeout for the next tick.&lt;/P&gt;
&lt;P&gt;It should be noted that the signature for the handlers is always (sender, arguments) where arguments are an instance of a class derived from &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx"&gt;Sys.EventArgs&lt;/A&gt;. Here, there's really no relevant information that we want to send to the handlers, so we're just using &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/EventArgsEmptyObject.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/EventArgsEmptyObject.aspx"&gt;Sys.EventArgs.Empty&lt;/A&gt;, which is a special, empty instance of &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx"&gt;Sys.EventArgs&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;For your own events, you can build your own class that derives from &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx"&gt;Sys.EventArgs&lt;/A&gt;. You should clearly document that this new class works with your event. Typically, the new argument class should take a constructor parameter for each of the pieces of information you want to transmit to the handlers. There should also be a property getter for each of those, but there usually won't be a setter. The reason is that these arguments should most of the time be considered immutable. There are a few cases though&amp;nbsp;when this is not true and the handlers should be able to communicate back to the event publisher. One example of that is cancellable events (see &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/CancelEventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/CancelEventArgsClass/default.aspx"&gt;Sys.CancelEventArgs&lt;/A&gt;&amp;nbsp;and its &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/CancelEventArgsClass/CancelEventArgsCancelProperty.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/CancelEventArgsClass/CancelEventArgsCancelProperty.aspx"&gt;cancel&lt;/A&gt; property). What's important in those case is that handlers should never rely on the values of those mutable properties. Only the event publisher can do anything depending on them. In the cancellable case, for example, what setting cancel to true does is prevent an action that would have happened *after* all the handlers have been called, but it doesn't prevent the remaining handlers from being called.&lt;/P&gt;
&lt;P&gt;In the&amp;nbsp;case of the Timer component, the event is raised by an externally happening source (the timeout feature exposed by JavaScript), which is why _tick is a private function. In some cases, it may be desirable to make it possible for public consumers of the class to raise the event. In this case, the convention is to expose a public method named "raise[event name]". For example, the base &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx"&gt;Sys.Component&lt;/A&gt; class exposes a &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentRaisePropertyChangedMethod.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentRaisePropertyChangedMethod.aspx"&gt;raisePropertyChanged&lt;/A&gt; method that is typically called by derived classes to raise the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentPropertyChangedEvent.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentPropertyChangedEvent.aspx"&gt;propertyChanged&lt;/A&gt; event&amp;nbsp;from the setters of properties that wish to advertise their changes.&lt;/P&gt;
&lt;P&gt;Most of the time though, the event will be raised as part of a larger operation, which is what's being exposed publicly, and there's no point in having a "raise..." method.&amp;nbsp;Once more, an example of that can be found in &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx"&gt;Sys.Component&lt;/A&gt;: dispose raises the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentDisposingEvent.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentDisposingEvent.aspx"&gt;disposing&lt;/A&gt; event before it actually does&amp;nbsp;its cleanup work.&lt;/P&gt;
&lt;P&gt;This pretty much covers what you need to know to implement your own custom events. In the next and final post in this series, I'll show how to integrate Microsoft Ajax events with the OpenAjax hub.&lt;/P&gt;
&lt;P&gt;Full code for the timer component:&lt;BR&gt;&lt;A title=Timer.js.txt href="http://weblogs.asp.net/blogs/bleroy/Samples/Timer.js.txt" mce_href="http://weblogs.asp.net/blogs/bleroy/Samples/Timer.js.txt"&gt;Timer.js.txt&lt;/A&gt;&amp;nbsp;(rename to Timer.js before using that file)&lt;/P&gt;
&lt;P&gt;A sample page that uses the component:&lt;BR&gt;&lt;A title=Clock.aspx.txt href="http://weblogs.asp.net/blogs/bleroy/Samples/Clock.aspx.txt" mce_href="http://weblogs.asp.net/blogs/bleroy/Samples/Clock.aspx.txt"&gt;Clock.aspx.txt&lt;/A&gt;&amp;nbsp;(rename to Clock.aspx and include in a Microsoft Ajax site with Timer.js&amp;nbsp;to use)&lt;/P&gt;
&lt;P&gt;Read part 1 of this post:&lt;BR&gt;&lt;A title="Microsoft Ajax events - part 1- subscribing" href="http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx" mce_href="http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx"&gt;Microsoft Ajax events - part 1 - subscribing&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2638346" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category></item><item><title>Microsoft Ajax events - part 1: subscribing</title><link>http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx</link><pubDate>Thu, 17 May 2007 00:20:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2607588</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=2607588</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/05/16/microsoft-ajax-events-part-1-subscribing.aspx#comments</comments><description>&lt;P&gt;When building Ajax applications, you basically deal with two kinds of events. First, there are &lt;A href="http://weblogs.asp.net/bleroy/archive/2006/11/06/DOM-events-in-the-Microsoft-AJAX-Library.aspx" mce_href="http://weblogs.asp.net/bleroy/archive/2006/11/06/DOM-events-in-the-Microsoft-AJAX-Library.aspx"&gt;DOM events&lt;/A&gt;, and second, events from JavaScript objects. This second category is not part of the EcmaScript specs (or of the DOM specs, of course) so each framework needs to define its own pattern to expose events. This makes it more difficult for developers to include components built on different frameworks into a single page, which is one of the problems that&amp;nbsp;&lt;A href="http://www.openajax.org/" mce_href="http://www.openajax.org/"&gt;OpenAjax&lt;/A&gt; tries to solve. I'll get back to this in a future post and show how to integrate Microsoft Ajax events in the &lt;A href="http://www.openajax.org/" mce_href="http://www.openajax.org/"&gt;OpenAjax&lt;/A&gt; hub.&lt;/P&gt;
&lt;P&gt;As with other parts of the Microsoft Ajax framework, we've tried to adhere to the .NET patterns as much as possible when we designed events in Microsoft Ajax. Events are defined by their "add" and "remove" accessors, which respectively add and remove handlers. For instance, &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/default.aspx"&gt;PageRequestManager&lt;/A&gt; exposes a "&lt;A href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx"&gt;beginRequest&lt;/A&gt;" event by exposing the "add_beginRequest" and "remove_beginRequest" methods. Both add and remove accessors have the same signature, which is that they take a single "handler" parameter of type Function.&lt;/P&gt;
&lt;P&gt;So handling an event is twofold. First, you must&amp;nbsp;subscribe to an event, which&amp;nbsp;is as simple as the following highlighted code:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="BACKGROUND: rgb(255,238,98)"&gt;&amp;lt;%&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&lt;/SPAN&gt;@&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(163,21,21)"&gt;Page&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="C#"&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND: rgb(255,238,98)"&gt;%&amp;gt;

&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&lt;/SPAN&gt;&amp;lt;!&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;DOCTYPE&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;html&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;PUBLIC&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;BR&gt;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;

&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;html&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;head&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;&lt;/SPAN&gt;Untitled Page&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;script&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;type&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="text/javascript"&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt; pageLoad() {
            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;var&lt;/SPAN&gt; prm = Sys.WebForms.PageRequestManager.getInstance();
            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;if&lt;/SPAN&gt; (!prm.get_isInAsyncPostBack()) {
                &lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;prm.add_beginRequest(onBeginRequest);&lt;/SPAN&gt;
            }
        }
        
        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt; pageUnload() {
            Sys.WebForms.PageRequestManager.getInstance()&lt;BR&gt;                .remove_beginRequest(onBeginRequest);
        }
        
        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;function&lt;/SPAN&gt; onBeginRequest(sender, args) {
            Sys.Debug.trace(args.get_postBackElement().value +&lt;BR&gt;                &lt;SPAN style="COLOR: rgb(163,21,21)"&gt;" triggered a postback."&lt;/SPAN&gt;);
        }
    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;script&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;form&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="form1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;ScriptManager&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="SM1"&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;ScriptManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;UpdatePanel&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="UP1"&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;ContentTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;                &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;Button&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button 1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/SPAN&gt;                &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;Button&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button2"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button 2"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/SPAN&gt;                &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;Button&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button3"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="Button 3"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;/&amp;gt;
&lt;/SPAN&gt;            &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;ContentTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;UpdatePanel&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;textarea&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="TraceConsole"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;cols&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="40"&lt;/SPAN&gt; &lt;SPAN style="COLOR: rgb(255,0,0)"&gt;rows&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;="15"&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;textarea&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(163,21,21)"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR: rgb(0,0,255)"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This page starts by subscribing to the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx"&gt;beginRequest&lt;/A&gt; event of the page request manager. The handler for the event which is passed to add_beginRequest, onBeginRequest, looks at the event arguments and displays the value of the button that triggered the postback in the trace console. This brings us to the second half of using events, writing the handler. All Microsoft&amp;nbsp;Ajax event handlers, by convention, and exactly like in .NET,&amp;nbsp;have a similar signature: they take two parameters, the event sender and the event arguments. The sender is the object that raised the event (in the example above, that would be the PageRequestManager) and the arguments are an instance of a type that derives from &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/EventArgsClass/default.aspx"&gt;Sys.EventArgs&lt;/A&gt;. Many events will be associated with a specific argument class to enable the handler to get additional and specific information about the event. In the example above, we're using the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/BeginRequestEventArgsClass/BeginRequestEventArgsPostbackElementProperty.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/BeginRequestEventArgsClass/BeginRequestEventArgsPostbackElementProperty.aspx"&gt;postBackElement&lt;/A&gt; property of the arguments, which are of type &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/BeginRequestEventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys.WebForms/BeginRequestEventArgsClass/default.aspx"&gt;Sys.WebForms.BeginRequestEventArgs&lt;/A&gt;. Similarly, the &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentPropertyChangedEvent.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/ComponentPropertyChangedEvent.aspx"&gt;propertyChanged&lt;/A&gt; event on &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/ComponentClass/default.aspx"&gt;Sys.Component&lt;/A&gt; is associated with &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/PropertyChangedEventArgsClass/default.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/PropertyChangedEventArgsClass/default.aspx"&gt;Sys.PropertyChangedEventArgs&lt;/A&gt;, which&amp;nbsp;exposes a &lt;A href="http://ajax.asp.net/docs/ClientReference/Sys/PropertyChangedEventArgsClass/SysPropertyChangedEventArgsPropertyNameProperty.aspx" mce_href="http://ajax.asp.net/docs/ClientReference/Sys/PropertyChangedEventArgsClass/SysPropertyChangedEventArgsPropertyNameProperty.aspx"&gt;propertyName&lt;/A&gt; property that enables the handler to determine the name of the property that triggered the event. In other words, to learn how to properly handle an event, start by exploring its associated arguments class.&lt;/P&gt;
&lt;P&gt;In the &lt;A class="" href="http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx" mce_href="http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx"&gt;next post&lt;/A&gt;, I'll show how to expose a custom event from your own classes:&lt;BR&gt;&lt;A href="http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx"&gt;http://weblogs.asp.net/bleroy/archive/2007/05/22/microsoft-ajax-events-part-2-exposing-events-from-custom-classes.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2607588" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category></item><item><title>OpenAjax meetings</title><link>http://weblogs.asp.net/bleroy/archive/2007/04/05/openajax-meetings.aspx</link><pubDate>Fri, 06 Apr 2007 03:52:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2186005</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=2186005</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/04/05/openajax-meetings.aspx#comments</comments><description>&lt;p&gt;It was my great pleasure to be at the face to face &lt;a href="http://www.openajax.org/"&gt;OpenAjax Alliance&lt;/a&gt; meetings for the first time&amp;nbsp;last month. Thanks to the nice people at &lt;a href="http://www.ibm.com/us/"&gt;IBM&lt;/a&gt; for hosting them. I really enjoyed the discussions with &lt;a href="http://alex.dojotoolkit.org/"&gt;Alex&lt;/a&gt; from &lt;a href="http://www.dojotoolkit.com/"&gt;Dojo&lt;/a&gt;, Gideon from &lt;a href="http://www.openspot.com/"&gt;OpenSpot&lt;/a&gt; and many others. There were also great demos of OpenAjax-based interoperability.&lt;/p&gt;&lt;p&gt;It was&amp;nbsp;also the occasion for me to visit New-York where I hadn&amp;#39;t been in more than fifteen years. After the initial shock of not recognizing the skyline from the plane, which affected me more than I expected, I just realized how much I love the atmosphere of a city where people actually walk. It reminded me in a way of Paris, where I lived most of my life. Here are some pictures...&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork200703104.jpg"&gt;&lt;img alt="Atlas in New-York" border="0" height="409" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070310_thumb2.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt;&amp;nbsp;&lt;br /&gt;Atlas in New-York&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070316.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="300" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007031_thumb4.jpg" style="border-width: 0px" width="400" /&gt;&lt;/a&gt; &lt;br /&gt;A walk in the park. The weather was mild enough to walk around without a jacket but the snow wasn&amp;#39;t melted yet. Very nice.&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070354.jpg"&gt;&lt;img alt="Very thin ice indeed: probably no more than a few angstr&amp;ouml;ms" border="0" height="300" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007035_thumb2.jpg" style="border-width: 0px" width="400" /&gt;&lt;/a&gt; &lt;br /&gt;Very thin ice indeed: probably no more than a few angstroms.&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070383.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="421" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007038_thumb1.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070323.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="391" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007032_thumb1.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070331.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="298" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007033_thumb1.jpg" style="border-width: 0px" width="400" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070341.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="294" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007034_thumb1.jpg" style="border-width: 0px" width="400" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070361.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="458" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007036_thumb1.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070371.jpg"&gt;&lt;img alt="A walk in the park" border="0" height="300" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007037_thumb1.jpg" style="border-width: 0px" width="400" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070391.jpg"&gt;&lt;img alt="View from my hotel room" border="0" height="400" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork2007039_thumb1.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt; &lt;br /&gt;View from my hotel room.&lt;/p&gt;&lt;p&gt;&lt;a href="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork200703111.jpg"&gt;&lt;img alt="Ice on lake Erie" border="0" height="400" src="http://leroy.blogdns.net/blog/content/binary/FirstOpenAjaxmeetings_BB2E/NewYork20070311_thumb1.jpg" style="border-width: 0px" width="300" /&gt;&lt;/a&gt;&amp;nbsp;&lt;br /&gt;Ice on &lt;a href="http://maps.live.com/default.aspx?v=2&amp;amp;cp=42.191899~-81.161499&amp;amp;style=h&amp;amp;lvl=9&amp;amp;tilt=-90&amp;amp;dir=0&amp;amp;alt=-1000"&gt;lake Erie&lt;/a&gt; as seen from the plane back to Seattle. To give a sense of scale, the blocks of ice are probably about a kilometer wide each.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2186005" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category></item><item><title>Microsoft joins OpenAjax</title><link>http://weblogs.asp.net/bleroy/archive/2007/03/20/microsoft-joins-openajax.aspx</link><pubDate>Tue, 20 Mar 2007 18:41:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2069517</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=2069517</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2007/03/20/microsoft-joins-openajax.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.openajax.org" title="OpenAjax"&gt;&lt;img align="right" alt="OpenAjax" border="0" height="107" hspace="5" src="http://blogs.msdn.com/photos/brada/images/1916813/original.aspx" title="OpenAjax" width="259" /&gt;&lt;/a&gt;I&amp;#39;m extremely&amp;nbsp;pleased to announce that we&amp;#39;re joining &lt;a href="http://www.openajax.org/"&gt;OpenAjax&lt;/a&gt; today and that I&amp;#39;ll represent the company in the organization&amp;#39;s meetings starting this Thursday. This is a way for us to ensure that our&amp;nbsp;user community&amp;nbsp;can&amp;nbsp;combine the Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions with other frameworks, today and in the future. Interoperability in the browser is a hard problem but it opens key Ajax scenarios. An industry-wide organization such as OpenAjax is a great way to ensure this goal is met in the long-term.&lt;/p&gt;&lt;p&gt;The press release:&lt;br /&gt;&lt;a href="http://www.marketwire.com/mw/release_html_b1?release_id=228535"&gt;http://www.marketwire.com/mw/release_html_b1?release_id=228535&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Brad&amp;#39;s post:&lt;br /&gt;&lt;a href="http://blogs.msdn.com/brada/archive/2007/03/20/microsoft-joins-the-openajax-alliance.aspx"&gt;http://blogs.msdn.com/brada/archive/2007/03/20/microsoft-joins-the-openajax-alliance.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2069517" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Microsoft+AJAX+Library/default.aspx">Microsoft AJAX Library</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/OpenAjax/default.aspx">OpenAjax</category></item></channel></rss>