Open Source Ajax for ASP.NET using Sarissa 

Friday, June 17, 2005 2:01:28 PM
Rate this Content 0 Votes

There's been a lot of buzz in the blogosphere lately about Ajax, a way of richening the UI experience in browser based applications.  Everyone is trying to catch up with Google and the cool UI things they have done with GMail and Google Suggest.  You can do some really cool things on a web page without posting back the page you are viewing to the server by using asynchronous web requests back to the server using built in features of the browser to make XmlHttp requests.

I have to admit that I'm excited about the possibilities myself but it strikes me a little funny to think this is something totally new because I was doing stuff like this 5 years ago using Xml Data Islands in IE. Of course I was only doing this on intranet applications where you had a guarantee of the browser being IE. The exciting thing today is that all the major browsers have some kind of support for these features so now it is possible to do these really cool things in public web sites.

In the ASP.NET quadrant of the blogosphere there is a lot of buzz about Ajax.NET by Michael Schwartz.  Prominant "open source" ASP.NET projects out there like Community Server are using this free library to put a little Ajax magic into their applications while they wait for the built in support for some of this magic in ASP.NET 2.0.  Unfortunately Ajax.NET while free, is not open source. You only get the dll for free. Michael made some noise about making the source code available a while back but it hasn't happened and I'm not under the impression that its going to. Now don't get me wrong I'm not criticizing Michael, if he doesn't want to make his code available thats his decision and I respect that but if he did I would use it in mojoPortal

In my day job I'm a corporate developer and I'm very pragmatic.  If I need some special functionality that might take quite a bit of time to develop myself I will look for an open source solution.  If I can't find an open source solution I will look for at least a free solution and if I can't find that I will consider a commercial solution.  Usually the applications I'm building are to solve some business need and to solve it quickly and third party controls can be very helpful in letting you focus on the business problem instead of tackling some complex UI issue that is just incidental to the project. For example last year I was working on a project at work for an intranet application where the user would enter a lot of information about a particular insurance claim. One of the pieces of information was to enter the service provider that did the work to resolve the claim and we needed to make sure this data matched one of the providers in the database so to prevent errors a dropdown list seemed more appropriate than a free text field in the UI. The problem was that there were thousands of providers and that would make one whopping long list for a dropdown in a web page which would guarantee poor performance if it was fully populated and would also be a usability nightmare since no-one wants to scroll through thousands of items in a drop down to find the one they want. What we needed was a smart dropdown that would match against what the user was typing and offer suggestions from the database that matched to ensure data consistency. This is the kind of thing that is not so hard to do in desktop applications but is quite a bit trickier in a web page. I considered trying to implement this myself but the company was willing to buy third party controls if needed and wanted the application in a hurry. If Ajax.NEt had been out at the time I probably would have looked at it but instead we went with a commercial solution called DbCombo. It worked well (in IE, but degrades to different functionality in other browsers) and was very fast. It met the needs of the project so we bought it and the company I work for has been very happy with the features it provides.

In mojoPortal, my open source web site framework and content management system, I cannot use commercial solutions to such problems and will not use solutions that are not open source.  Even if DbCombo was free it does not work the same in Firefox as it does in IE so its not a good solution for me. I could use Ajax.NET but since it is not open source I don't want to.  I feel the same way about FreeTextBox which is used in so many so called open source ASP.NET applications like Community Server, DotNetNuke, Rainbow Portal, etc but is not open source itself which to me means that any application that uses them is not entirely open source. Instead I use FCKeditor which is very nice and completely open source. But I digress, the topic of this post is Ajax.  A need has come up in mojoPortal where I need functionality pretty much like DbCombo. Most permissions in mojoPortal are handled by roles but there are cases where you want to give a single user permission on a particular feature instance (like a blog) and it is cumbersome to create a new role just for one user to make this possible. So I added a field for a user id on each feature instance so that permission could be granted to a single user. Since a web site could have thousands or even millions of registered users I can't just use a dropdown list but similar to my corporate project of last year I need to make it easy to find the user you are looking for.  Since I want to keep my project pure open source I started looking for ways to make browser neutral XmlHttpRequests and I found it in the Sarissa Project, which is an open source (LGPL) javascript wrapper that encapsulates the specific implementations in the different browsers and gives you a single javascript API to use in all browsers.  XmlHttpRequests is just one aspect of Ajax and Sarissa supports pretty much everything that is currently called Ajax. Using Sarissa I was able to implement the same feature provided by DbCombo but with the added benefit that it works in Firefox, Mozilla, and IE (maybe others too I haven't tested yet). I've been working on it every evening this week and its working pretty nicely now.  I'm not sure if it will make it into the new release of mojoPortal that I plan for this weekend, but if not this release then the next one in a few weeks. Its a pretty cool feature and the code to do it is rather simple once you know how. I don't doubt that some will scarf the code and use it outside of mojoPortal but I'm totally cool with that. I know I'll be using it in other places instead of DbCombo myself.  I'm sure there will be other challenging UI issues in mojoPortal that I will be able to tackle elegantly with Sarissa so I'm very glad I found it an encourage anyone who is interested to check it out.

Share This Using Popular Bookmarking Services
Copyright 2003-2010 Joe Audette

re: Open Source Ajax for ASP.NET using Sarissa

Saturday, June 18, 2005 4:26:01 AM Cassio R Eskelsen
Hi Joe!!!!

First, i' m a brazilian! My english is very bad!

I have the some necessity and I found another solution: http://momche.net/publish/article.php?page=acdropdown . I write a article(in portuguese, sorry!) on my personal website  , but you can found examples here

If I can help you, please send a mail to eskelsen at gmail.com

Cassio!

re: Open Source Ajax for ASP.NET using Sarissa

Saturday, June 18, 2005 4:43:13 AM Joe
Hi Cassio,

Thanks! I can't read the article but I can read the code!
Looks good!

Joe

re: Open Source Ajax for ASP.NET using Sarissa

Tuesday, June 21, 2005 4:10:43 AM Michael Schwarz
Hi to all, I will make Ajax.NET an open source project in the next days. I had to much emails in the last days that I only have time to answer, but no time to go on with the development of Ajax.dll.

re: Open Source Ajax for ASP.NET using Sarissa

Tuesday, June 21, 2005 4:17:29 AM Joe
Hi Michael,

Thats awesome! I look forward to using it once it is open source!

Joe

re: Open Source Ajax for ASP.NET using Sarissa

Thursday, June 14, 2007 10:09:34 PM unknown

What about "Aspects of Ajax", view "http://ajaxaspects.blogspot.com".  Es a important work in Ajax with the .NET framework.


re: Open Source Ajax for ASP.NET using Sarissa

Tuesday, July 10, 2007 7:42:30 AM unknown

re: Open Source Ajax for ASP.NET using Sarissa

Tuesday, July 10, 2007 7:42:48 AM unknown

Comments are closed on this post.
Donate Money to support the mojoPortal Project. View Joe Audette's profile on LinkedIn View Joe Audette's profile on The Guild of Accessible Web Designers site