Are you making these 3 common ASP.NET AJAX mistakes?

AJAX, ASP.NET By Dave Ward on October 24th, 2007

It’s important to remember that a partial postback is just that: A postback.

The UpdatePanel’s way of abstracting AJAX functionality behind standard WebForm methodology provides us with flexibility and familiarity. However, this also means that using an UpdatePanel requires careful attention to the ASP.NET Page Life Cycle.

In this post, I’d like to point out a few of the problems I’ve seen developers running into and what you can keep in mind to avoid them:

  • Page events still fire during partial postbacks.
  • UpdatePanel events fire, even when not updating.
  • Control event handlers fire after Load events.

Click here to read the rest of this post »

Easy incremental status updates for long requests

AJAX, ASP.NET, JavaScript, UI By Dave Ward on October 3rd, 2007

Animation of the multi state progressA problem that has always plagued web developers has been providing detailed progress indication for server-side tasks. The stateless nature of the HTTP protocol makes implementing a mechanism for constant, stateful progress information cumbersome. The main problem is that a given group of server side tasks will generally only result in one, aggregate response from the server.

In the ASP.NET community, several solutions have been offered. Some even provide an entire framework for monitoring the status of tasks in progress. However, they are convoluted and depend on constant server polling. I find polling for progress indication to be an inefficient approximation, when exact data is readily available.

With that in mind, I’d like to share an alternate method that I’ve used in the past with great success.

Click here to read the rest of this post »

ASP.NET AJAX Timer Trouble? Location is key.

AJAX, ASP.NET, JavaScript, Performance By Dave Ward on September 19th, 2007

If you’ve made much use of the ASP.NET AJAX Timer control, you may have noticed that it can behave somewhat unexpectedly. In this post, I’m going to take a closer look at how the Timer works and the most significant factor that influences it: Location.

Where the timer is placed on the page actually varies how it operates. As a Timer’s delay interval approaches the processing time of its resulting PostBack, the difference that the Timer’s location makes becomes very significant.

Click here to read the rest of this post »

Seamless inline text editing: The Control!

AJAX, ASP.NET, UI By Dave Ward on September 17th, 2007

In my recent post, Seamless inline text editing with ASP.NET AJAX, I thought I had outlined the simplest possible way to implement the technique, but I was wrong. One of my readers, Mike Davis, took what I began and built it into the beginnings of a great ASP.NET server control.

The initial release is available here: Inline Edit Box .NET

With it, you can transparently implement the inline editable label functionality with only one line of code. He’s not finished refining it and adding new features yet, so he would like your input on where to go from here.

Download it, give it a try, and leave Mike some feedback in the comments on the download page today!

Seamless inline text editing with ASP.NET AJAX

AJAX, ASP.NET, JavaScript, Performance, UI By Dave Ward on August 23rd, 2007

Inline text editing animationThis is a technique that I really like. It’s excellently suited to intranet sites and administrative interfaces, where your users are typically familiar enough with the application to know which text they can click to edit. It’s actually very easy to implement, with a small amount of JavaScript.

Click here to read the rest of this post »

Updated your web.config, but Sys is still undefined?

AJAX, ASP.NET, JavaScript By Dave Ward on August 16th, 2007

Sys is not defined error message

If you Google the error you’ll find a lot of results about updating your web.config to enable ASP.NET AJAX (which is a necessary step), but what if you’ve already done that? Not only will your search be an exercise in frustration, but it will lead you down the wrong path completely. Maybe I can help.

Click here to read the rest of this post »

Robust ASP.NET control referencing in JavaScript

AJAX, ASP.NET By Dave Ward on August 8th, 2007

As you may know, ASP.NET controls often render with client-side IDs different than what’s declared in your aspx code. Especially when they’re nested in other controls (Tabs, Wizard, GridView, etc). When working with them on the server side this isn’t an issue, but tends to throw a monkey wrench into the gears of client-side development. Here’s an example:

Click here to read the rest of this post »

Highslide JS .NET (v0.4)

AJAX, ASP.NET, Highslide, UI By Dave Ward on August 3rd, 2007

Embedded outline graphics!

Finally, the control does what I really wanted it to from the start: It completely encapsulates Highslide JS into a single file. You no longer need a graphics/outlines directory with external outline images. Absolutely everything you need is embedded in the control’s .DLL.

If you’re upgrading from a previous version, drop the GraphicsPath property from your HighslideManager control and feel free to delete the outlines directory from your site.

As always, the latest version is available on the Highslide JS .NET download page.

Simplify ASP.NET AJAX client-side initialization

AJAX, ASP.NET, UI By Dave Ward on August 1st, 2007

I recently found myself needing to perform a bit of client-side page initialization, both on initial page load and when partial postbacks completed. I muddled through by using window.OnLoad() for the initial page load and an EndRequest handler for partial postbacks. It worked, but I wasn’t very happy with the kludgey nature of it.

On an unrelated ASP.NET forums thread around the same time, Steve Marx pointed out to me that the AJAX framework automatically wires up any client-side function named pageLoad() as an Application.Load handler. It’s actually in the docs, if you dig for it:

To handle the load and unload events of the Application object, you do not have to explicitly bind a handler to the event. Instead, you can create functions that use the reserved names pageLoad and pageUnload.

Click here to read the rest of this post »

Get Yahoo’s HTTP performance analysis tool

AJAX, ASP.NET, Performance By Dave Ward on July 25th, 2007

YSlow, Yahoo’s previously internal-only HTTP profiling tool, has been released to the public. It extends FireBug to analyze a page and provide an optimization checklist.

After experimenting with it for a bit today, I think it will quickly become as integral to my performance tuning as FireBug itself.

Get it here: http://developer.yahoo.com/yslow/