NET AJAX 105
Imagine, for instance, that your page contains critical and dynamic information such
as stock quotes or flight arrival information that needs to be updated on a regular basis.
You can use the Timer control on your page to trigger updates to an UpdatePanel control,
all without having to do any full-page refreshes.
Using the Timer Control
To use a Timer control, you of course need a ScriptManager control on the page. You can
add a Timer control to a page by dragging and dropping it onto the control surface. A
good use for timers is to update the contents of an UpdatePanel control when the timer
ticks.
To see the Timer control in action, you can add an UpdatePanel control to a blank page
along with a ScriptManager control. After you??™ve done this, you can drag and drop a Timer
control onto the page. Also, place a Label control in the UpdatePanel. You can see what this
looks like in the designer in Figure 5-12.
Figure 5-12. Using a Timer control in the designer
CHAPTER 5 ?– INTRODUCING SERVER CONTROLS IN ASP.NET AJAX 106
Lastly, double-click the Timer control so that it will generate the event handler stub for
the OnTick event of the Timer control.
Pages:
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180