Triggering Events after a Delay
Sometimes, you may want events to trigger their assigned actions after a delay. A good example
of this here is the KeyPress we added below. As the user enters in data into the textbox,
we make an AJAX call to update the label. However, in order to make the system a bit more usable
and streamlined, we have added a half-second (500 ms) delay on the KeyPress, so that
we are not making too many AJAX calls as the user is still entering in data.
Basically, this allows the action to be triggered only after the user is done typing in the data.
Note that we maybe could have used a Change on the textbox to achieve a similar effect. But
triggered after the control loses focus and has been changed -- it won't be triggered purely
by the fact that the text in the textbox has been changed.