NET is not as integrated as we would like. The core problem
is that the onsubmit client event is not fired if the HTML form is submitted programmatically
via JavaScript. To demonstrate the need for better integration, the Confirm web form hosts a
set of form posting controls.
On the Confirm web form are a regular ASP.NET Button that does a traditional HTML form
post and an ASP.NET LinkButton that uses JavaScript from ASP.NET to cause a postback. We
also have our FormConfirmation and ConfirmedLinkButton server controls to show how they
provide confirmation on form submit in their own unique manner. Figure 8-4 shows the static
web form display output.
Figure 8-4. The Confirm web form
370 CHAPTER 8 ?– I NTEGRAT ING CLI ENT-SI D E SCRIPT
The code-behind web form class has logic to announce which control was responsible for
the postback to help us see what is going on. The first control we exercise is the regular ASP.NET
Button on the form. This Button causes the form to post, but we plugged into this mechanism
with the FormConfirmation server control. When this button is clicked, it kicks off the
FormConfirmation server control??™s JavaScript code according to the setting on its Message property,
as shown in Figure 8-5.
Pages:
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486