Prev | Current Page 471 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

This simple control takes advantage of the
ClientScriptManager class??™s RegisterOnSubmitStatement method we described previously to
properly inject the script into the HTML stream loaded in the browser. Just drop the control
on a web form, and voil? ! You can confirm that the user is ready to proceed with submitting
the form back to the server. If the user does not affirm the form submission, the script cancels the
action by returning false. The other item to highlight for this control is the Render override
for the purposes of ensuring the control is located inside a web form via the Page class??™s
VerifyRenderingInServerForm method.
In the next section, we discuss an interesting variation on this theme of confirming navigation
away from a page by adding the capability of checking whether a user wants to move on
to a new page or stay on the current web form.
The ConfirmedLinkButton Control
The ConfirmedLinkButton button prompts with a custom message that will not navigate if the
user cancels the action. ConfirmedLinkButton does not use the RegisterOnSubmitStatement of
the ClientScriptManager class; rather, it uses the client-side postback system of ASP.NET.
368 CHAPTER 8 ?–  I NTEGRAT ING CLI ENT-SI D E SCRIPT
We use this control on a web form in conjunction with the previously created FormConfirmation
control to show how the two mechanisms interact.


Pages:
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483