NET development environment; our control is
shown in Figure 8-8.
The UpDown server control takes the form of a composite control with a TextBox to hold the
value and two Buttons with the captions + and ??“ to represent up and down incrementing clicks.
Although the UI is not spectacular, it permits us to show how to wire up client script with
server events.
CHAPTER 8 ?– INTEGRATING CL IENT-SIDE SCRIPT 375
Figure 8-8. The UpDown Windows Forms desktop control
If the browser supports it, the UpDown server control emits JavaScript that increments or
decrements the value in the TextBox in the local environment of the browser without having to
make a round-trip to the web server to perform these operations. Client-side operations include
the same functionality available in the server-side events, such as range checking, though we
simply display a message notifying the user of the input error while in the server-side events we
throw an ArgumentOutOfRangeException. The UpDown server control has a number of important
properties that we discuss in the next section.
Key Properties: MinValue, MaxValue, Increment, and Value
The UpDown server control exposes four properties that allow developers to configure its behavior in
the Visual Studio Designer: MinValue, MaxValue, Increment, and Value.
Pages:
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492