Disable a button control during postback.

ASP.NET, UI By . Updated October 10, 2008

Postback Ritalin has been getting a lot of search hits intended to find a button disable technique for full .NET postbacks. So, this example is for all of you searching for a non-AJAX solution.

The trick is to use the OnClientClick and UseSubmitBehavior properties of the button control. There are other methods, involving code on the server side to add attributes, but I think the simplicity of doing it this way is much more attractive:

Click here to read the rest of this post »

Highslide JS .NET Release

AJAX, ASP.NET, CSS, Highslide, UI By . Updated October 10, 2008

My initial .NET server control version of Torstein Honsi’s Highslide JS .NET is now available. You can find it and information on implementing it at the Highslide JS .NET page here on my site.

For a quick video introduction of what the Highslide JS library is capable of, take a look at this basic demonstration:

Click here to read the rest of this post »

Image Zooming Control Preview

AJAX, ASP.NET, CSS, Highslide, UI By . Updated October 10, 2008

Update: Highslide JS .NET is available for download now.

I’ve been working on and off for some time to encapsulate Torstein Honsi’s excellent Highslide JS library into a .NET control. Finally, pending naming, it is ready for use. It should be available for download in the next couple days. Until then, here is a preview of it in action:

Click here to read the rest of this post »

Postback Ritalin Update (v0.2)

AJAX, ASP.NET, UI By . Updated October 10, 2008

Based on my experience using it in the wild and some great feedback from those of you that downloaded it, I’ve made a few updates to Postback Ritalin. Get it and enjoy.

If you haven’t seen Postback Ritalin yet, it’s an AJAX Toolkit control extender to automatically disable an UpdatePanel’s submitting control during partial postbacks and then re-enable them after the partial postback completes. More details are available on the permanent Postback Ritalin page.

Click here to read the rest of this post »

Debug and explore AJAX with FireBug

AJAX, ASP.NET By . Updated March 3, 2009

“where did you find documentation on the sender and event args objects in the PageRequestManager events?”

Lately, if I don’t hear that question at least a dozen times a week, I start worrying that something’s wrong with my contact form. I can understand why it would be a common question. The documentation we currently have for the JavaScript portion of the AJAX framework is on the light side.

To answer the question: I didn’t. However, I can show you something even better.

Click here to read the rest of this post »

AJAX, file downloads, and IFRAMEs

AJAX, ASP.NET, UI By . Updated March 10, 2012

CSV file download link“Click here to download this report in Excel (CSV) format.”

We’ve probably all implemented this functionality in ASP.NET applications at least several times. Any time you’re dealing with report data, it’s expected that the data be available for download. Unfortunately, AJAX makes this somewhat difficult. Since there is no traditional HTTP response, you have no context with which to send the file to the browser for normal download.

Enter inline frames (IFRAME). Probably one of the most under utilized HTML elements around, dynamically creating an IFRAME allows you to round trip an HTTP request and response without disrupting the AJAX-ness of your async postback. Since any browser that supports XmlHttpRequest supports IFRAMEs, it is as safe to use as AJAX is in the first place. This is a simple example of the technique, using a static list of files in a dropdown, but it could be adapted to more dynamic file creation scenarios easily.

Click here to read the rest of this post »

Control to prevent multiple AJAX submits

AJAX, ASP.NET, UI By . Updated October 10, 2008

“To avoid duplicate credit card charges, only click the checkout button once!”

I’m always surprised at how many sites display a similar warning message on their final checkout page. Major sites. Between server side detection of multiple submissions and using OnClick to disable the submit button, there is no excuse for crossing your fingers and hoping your users don’t double click a submit button.

AJAX complicates the client side component of this equation. You can’t simply disable a button in the OnClick event, because the button will remain disabled in the case of a failed form validation or other exception. The optimal behavior is for the submit button to only be disabled during the async postback, and be re-enabled when the server side processing is completed. Using the AJAXToolKit, I’ve created a control extender to implement this functionality quickly and easily: Postback Ritalin.

Click here to read the rest of this post »

Automatic Sequential Postbacks

ASP.NET, UI By . Updated October 15, 2008

I ran into a situation recently where I needed to select a set of data, present it to the user, and then give them the option to process each item individually or all items automatically. Problem was, the item processing task was long running, which complicated the “process all items” scenario. Looping through each item and processing it all on the server side would’ve been easy enough to accomplish, but the chances of the user sitting through the 7 minute postback for 20 items was next to nil.

What I really needed was incremental progress feedback, so the user could see an update as each item was processed. Luckily, I did have control over my user’s browser version and settings, so client scripting was available. With that in mind, this is the solution I came up with:

Click here to read the rest of this post »

CSS style as ASP.NET AJAX progress indicator

AJAX, ASP.NET, CSS, UI By . Updated October 15, 2008

Update Panel with Animation I noticed that a lot of people found my mouse pointer as AJAX progress indicator example by using search terms suggesting they were looking for a more graphical indicator. So, here’s an example of doing something more… Web 2.0.

Like last time, I’ll base it on a standard UpdatePanel demo using a button control to set a time/date label, with an artificial delay:

Click here to read the rest of this post »

Mouse pointer as ASP.NET AJAX progress indicator

AJAX, ASP.NET, CSS, UI By . Updated June 25, 2007

Update: If you’re looking for something more graphical, also see my example of using a CSS style as AJAX progress indicator.

The ASP.NET AJAX UpdatePanel control provides us a quick and easy way to AJAX enable websites without changing our familiar design patterns. It’s certainly much better than using full postbacks in many situations.

However, it lacks usability. While the user waits on the async postback to occur, they are left without any of the usual indicators. We’ve spent decades training our users to wait when they see an hourglass icon. Why throw all that away for a spinning Web 2.0 progress indicator that means little to an average user?

Luckily, the ASP.NET AJAX framework provides us with tools to correct this shortcoming.

Click here to read the rest of this post »