Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [456]

By Root 5458 0
caused the postback:

function OnEndRequest(sender, args)

{

if (typeof(currentPostBackElem) === "undefined")

return;

if (currentPostBackElem.id.toLowerCase() === "btnStartTask")

{

$get("btnStartTask").disabled = false;

}

}

Wouldn’t it be nice if you could visually notify users that a certain region of the screen has been updated? As you’ve seen, partial rendering improves the user experience with pages by eliminating a good number of full refreshes. If you look at it from the perspective of the average user, though, a partial page update doesn’t have a clear start and finish like a regular Web roundtrip. The user doesn’t see the page redrawn and might not notice changes in the user interface. A good pattern to employ is to use a little animation to show the user what has really changed with the latest operation. You can code this by yourself using the pair of beginRequest and endRequest events, or you can resort to a specialized component—an UpdatePanel extender control—as you’ll see in a moment.

Important

The disabled HTML attribute works only on INPUT elements. It has no effect on hyperlinks and tags. If you plan to use LinkButton controls, you have to resort to other JavaScript tricks to disable the user interface. One possible trick is temporarily replacing the onclick handler of the hyperlink with a return value of false. Another effective trick might be to cover the area to be disabled with a partially opaque DIV.

Aborting a Pending Update


A really user-friendly system always lets its users cancel a pending operation. How can you obtain this functionality with an UpdateProgress control? The progress template is allowed to contain an abort button. The script code injected in the page will monitor the button and stop the ongoing asynchronous call if it’s clicked. To specify an abort button, you add the following to the progress template:

In the first place, the button has to be a client-side button. So you can express it either through the element or the

Return Main Page Previous Page Next Page

®Online Book Reader