ASP.NET AJAX Beta 1 and ComponentArt Web.UI

Posted Tue Oct 31, 2006 @ 3:00 AM

We have recently completed converting our suite of user interface controls from the latest Community Technology Preview "Atlas" build to ASP.NET AJAX Beta 1. The Beta 1 release of ASP.NET AJAX is significant because it closely resembles what is soon going to be released as the official version 1.0 of the product. However, it does introduce some breaking changes from the CTP versions. I'll tell you about our experience, and give my thoughts on the state of Microsoft's new AJAX development framework.

Just to put things in perspective, our product consists of 12 UI controls that encapsulate common user interface elements (menus, trees, grids, etc.) exposing over 60 client-side classes built on top of the AJAX Library type system. For more information, visit the live demos or the client-side API reference.

After getting over the initial hump, we found ASP.NET AJAX Beta 1 to be remarkably well functioning and stable. Virtually every issue we ran into while converting our Web.UI library and samples to ASP.NET AJAX Beta 1 had to do with our own lack of understanding of how a particular feature works.

Judging by what is being said about ASP.NET AJAX Beta 1 in some blogs and forums, it appears that other people are in a similar situation. Unfortunately, some of them are concluding (incorrectly, I think) that the product itself is buggy. My impression is that Beta 1 is a significant step forward from the CTP versions, and that it is starting to feel like a production-quality release.

For clarity, I will talk separately about converting the core Web.UI library and the live samples application. Most people who have written applications based on a CTP version of "Atlas" will only need to deal with the latter.

Converting the Core Web.UI Library

We addressed the following changes while converting from CTP "Atlas" bits to ASP.NET AJAX Beta 1:

1. Class definitions through prototypes instead of closures. One of the biggest changes in Beta 1 is that prototypes are now being used to define JavaScript classes (more info on Bertrand Le Roy's excellent blog: part 1, part 2). We were actually already using prototype-based class definitions with CTP builds of "Atlas", so no changes were necessary here. So far so good!

2. The new model for client-side events. The old syntax for assigning events on the client was:

  object.eventName.add(eventHandler);

The new syntax is:

  object.add_eventName(eventHandler);
  object.remove_eventName(eventHandler);

For example:

  TreeView1.add_nodeSelect(TreeView1_onNodeSelect);

So, instead of having event objects with add/remove methods, we now have add_eventName and remove_eventName methods on the main object directly. Another related Beta 1 addition is the "events" collection on the Sys.Component base class.

We went ahead and applied these changes across the board.

3. The exclusion of type descriptors from the core product. Type descriptors provide the ability to discover type characteristics of a client-side object at runtime. You can use type descriptors to get the list of properties, methods, and events of an object, along with other applicable meta data. To support this functionality, an AJAX Library class needs to implement the Sys.ITypeDescriptorProvider interface. We had this implemented for all of our client side classes.

Since type descriptors were primarily designed to support xml-script, and Microsoft decided not to make xml-script a part of the core v1.0 product (it is still available in the "value add" portion), type descriptors were also moved to the "value add" bucket.

This was probably the biggest disappointment for us when it comes to Beta 1 changes. We found type descriptors to be universally useful, and - even though they were not originally designed to provide reflection - they still give the ability to discover the structure of an object at runtime, which enables some really elegant generic code.

Since our decision was not to make any required dependencies on "value add" functionality, we ended up implementing our own rudimentary reflection for all Web.UI client-side classes. Of course, if a customer of ours does include the "value add" portion of ASP.NET AJAX in their app, they will get support for type descriptors as expected.

4. Support for the new and improved UpdatePanel control. When we first tried the Beta 1 build with Web.UI, none of our controls worked with the new version of the UpdatePanel control. This was pretty depressing for a few minutes, until we remembered what was said at the Atlas Strategic Design Review lab we attended back in August. Client scripts now have to be registered through the ASP.NET AJAX ScriptManager object (as opposed to the ASP.NET Page object).

More info on this change was posted by the developer of the UpdatePanel control Eilon Lipton here. I really like the new version of the UpdatePanel control. I will try to blog about that separately soon.

Converting the Live Samples Application

In comparison to the work described above, converting the live samples application was an easy and routine exercise. My guess is that most developers who have built applications based on CTP bits of "Atlas" should be able to follow similar steps and get to the finish line fairly quickly.

Here is what we did:

1. Removed the old Microsoft.Web.Atlas.dll project reference, and added a reference to the new Microsoft.Web.Extensions.dll, which is now installed in the GAC;

2. Added a reference to the new ComponentArt.Web.UI.dll, build 2006.2.1470.3;

3. Changed the <atlas: tag prefix to <asp:;

4. Applied the following API changes to all UpdatePanel instances:
            a. Changed the Mode property to UpdateMode;
            b. Changed all EventTrigger entries under the Triggers section to AsyncPostBackTrigger.

At this point we were able to compile the app.

5. Then we changed all $ JavaScript calls to get$. In order to play nicely and not cause collisions with other frameworks, Microsoft has decided to rename the $ function to $get. This function essentially evaluates to document.getElementById, making it easier to get instances of DOM objects in your code.

That was it!

The entire conversion effort took about 4 days, which really isn't bad considering the size of our product.

Without any doubt, there is a lot of room for improvement of documentation, samples and tutorials for the upcoming ASP.NET AJAX releases. Maybe more than the core framework itself. The really good news is that all of the big changes are already included in the product, so it's a great time to start developing with ASP.NET AJAX!

I would be curious to hear about your experience with ASP.NET AJAX Beta 1, especially if you are using ComponentArt Web.UI.

Comments

Posted on Tue Oct 31, 2006 @ 3:00 AM

The folks over at ComponentArt have started blogging. According to the dates of posts, the blog just

Posted on Tue Oct 31, 2006 @ 3:00 AM

Miljan over at ComponentArt wrote his first post explaining how their migration to Beta 1 went (i.e.

Posted on Tue Oct 31, 2006 @ 3:00 AM

While not a customer of your product (indirectly as I do use Community Server)... did want to state that was an excellent entry and demonstrates that you guys providing custom controls for the $ - do so - because you are on top of the game..(after all sales is all about supplying the product or service successfully because you target a customer's wants not needs...)....Furthermore demonstrates your company's agility in the marketplace. To turn around and provide fully beta1 products within just a few weeks of release... astonishing...and willing to write a somewhat technical blog entry of it...kudos... Keep up the good work and look forward to your future blogs...

Posted on Tue Oct 31, 2006 @ 3:00 AM

great post!  I agree with Jody, you guys are definitely on top of your game.  I had a little trouble with the designer when I switched my tag prefixes to <asp: ...I had to change them again to something different like <ajax: -  Just a warning, the designer and the source view in Studio behave pretty erratically if you use <asp:.  At least they did for me...

Keep up the good work - I'm definitely subscribing to this blog!

Posted on Tue Oct 31, 2006 @ 3:00 AM

Hi Miljan,

Cool blog post! And welcome to blogging...

While its great to see the framework one has worked on serve as a foundation for even more cool technology, its always amazing to see the richness that component developers add to the platform, how you guys go through and figure out all of the extensibility... and also effectively workaround some of the things we missed. :-)

Posted on Tue Oct 31, 2006 @ 3:00 AM

cant I put the Microsoft.Web.Extensions.dll in the BIN folder. I am using Shared hosting. and they might not install the beta version. What can  be done in my case

I you have an answer please answer here

http://www.vikramlakhotia.com/New_Beta_version_of_the_ASPNET_AJAX_released.aspx

Posted on Tue Oct 31, 2006 @ 3:00 AM

I'm not going to post the answer to your site, vikram (bad form to ask a question and then request someone post the answer elsewhere) but people I know have put the dll in the bin folder and have not seen any issues YET.  Scott Guthrie's blog seems to indicate that something in the Microsoft Ajax beta requires Full Trust, but the people I spoke to haven't figured out what yet.

It should work okay, normal disclaimers apply as I have not had time to experiment myself.

Wayne

Posted on Tue Oct 31, 2006 @ 3:00 AM

I don't know what the underlying problem is but I know that...

ASP.NET Web Application (VS.NET 2005 SR Beta 1) the copy local is turned off...if you turn it on (right click properties) it will be included.

If you are using the Website you will need to copy it into the bin directory after making a reference to the dll, there are no right click properties on the references on a website... which in my opinion is one of many mistakes but that's another topic.

That I have it "working" on our projects...

Posted on Tue Oct 31, 2006 @ 3:00 AM

Subscribed! Its great to see you blogging.

Posted on Tue Oct 31, 2006 @ 3:00 AM

Thank you for the great feedback everyone!

It is especially encouraging to see senior members of the ASP.NET team grace us with their presence here.

As ScottW said, breaking into blogging is easy; the hard part is keeping it up. So, I'll definitely keep that in mind moving forward.

Posted on Tue Oct 31, 2006 @ 3:00 AM

There are a few good guides already on the internet that provide an overview of

Posted on Tue Oct 31, 2006 @ 3:00 AM

The folks over at ComponentArt have started blogging. According to the dates of posts, the blog just...

Posted on Tue Oct 31, 2006 @ 3:00 AM

The final version of ASP.NET AJAX was released today. We are very pleased to simultaneously announce

Click here to log in or create an account.