AJ's blog

May 12, 2007

Javascript and ASP.NET

Filed under: .NET, .NET Framework, ASP.NET, Software Development — ajdotnet @ 4:03 pm

ASP.NET was never a pure server side framework. Right from Version 1.0 it employed scripts for client side validation. Back then it was meant to…, well set IE users apart, because it worked only as improvement for them. Complementing one’s own server controls with script was the champions league of ASP.NET development — and deployment of these controls was a paint in the… (children around? Sorry!)

Anyway, much is changing in this area. With ASP.NET 2.0 Microsoft has introduced the WebResourceAttribute to adress the deployment problem. (See Creating Custom ASP.NET Server Controls with Embedded JavaScript for a better example.) Ajax is doing away with the browser dependency issues and Microsoft has changed its attitude accordingly, resulting in cross browser capabilities in ASP.NET AJAX.

There is still some work to do to better integrate server side and client side coding model. The ASP.NET AJAX Control Toolkit uses some patterns to better handle scripts (via the RequiredScriptAttribute, though not documented) and to address client side properties and events. Supporting postbacks and server side events is still a little awkward, though.

One thing is for sure: With ASP.NET AJAX Microsoft is taking ASP.NET control development as well as scripting to the next level (if only of complexity). If you’ve coded controls using script before, this is a good thing for you. Or it will render your patterns obsolete, who knows. If you’ve only scratched scripting yet, well, prepare for some work. Javascript is not as easy at is seems and ASP.NET AJAX definitely pushes the limits.

That’s all for now folks,
AJ.NET

kick it on DotNetKicks.com

About these ads

3 Comments »

  1. You should have a look at the Anthem Ajax controls. Anthem has the same type of controls as ASP.NET 2.0 (grids, lists, calendar etc), but with an interesting twist: something they call callback in stead of the traditional postback. No page refresh required. I wish Microsoft had thought of that a few years ago when they invented the postback :D

    Comment by Anders Nygaard — May 15, 2007 @ 9:43 am

  2. Have a look at the http://jsc.sf.net project.

    Especially see the screencast http://jsc.sourceforge.net/screencasts/2007.05.01/

    With jsc you can write client side code within your .net project while not relying on the silverlight project.

    Comment by zproxy — May 15, 2007 @ 2:44 pm

  3. @Anders:

    I have read a lot about available AJAX frameworks and control libraries, including Anthem (I needed to know whether ASP.NET AJAX can compete :-)) but I haven’t actually tested it.

    Anthem appears to use a similar pattern as the ASP.NET AJAX UpdatePanel: do an asynchrounous postback, process the whole page, sent the differences to the client (not sure if Anthem does that) and mix old and new HTML together. The main difference is that Anthem builds this feature into every control (which allows fine grained control but makes it mandatory to use these controls, sometimes derive from them), while the UpdatePanel can be put around any HTML fragment without the need to change any of the controls. The ASP.NET AJAX Control Toolkit uses extenders for the same reason, not to have to derive (i.e. replace existing) controls.
    All in all, I like the ASP.NET AJAX approach better. But that’s only an opinion.

    What Anthem definitly lacks (even advertises as an advantage) is support in writing client side scripts. And this was exactly the point of my argument. I think that in the near future (control) developers will have to write more and more client side code. And the programming models will have to grow together to properly address that demand.

    And I have to say that I like the notion… or more to the point the uproar caused by the notion… that microsoft has invented the postback ;-)

    AJ.NET

    Comment by ajdotnet — May 16, 2007 @ 7:36 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 244 other followers

%d bloggers like this: