SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 166 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

For the sake of simplicity, let??™s create a page that
simulates a long running process by pausing the running thread for a few seconds.
To build this page, drop new ScriptManager, UpdatePanel, and UpdateProgress controls
on a new WebForm page. After that, create a new Button control in the UpdatePanel. In the
source view of the .aspx page, create a new tag within the
UpdateProgress tag with the following markup:

Calculating...

Your page should now look similar to Figure 5-10.
CHAPTER 5 ?–  INTRODUCING SERVER CONTROLS IN ASP.NET AJAX 103
Figure 5-10. Using the UpdateProgress control
Now, we can simulate a long running process when the button is clicked by pausing
the existing thread for four seconds in the event handler of the button:
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(4000);
}
When you run the page and click the Calculate button, you??™ll see that the string,
???Calculating??¦??? appears for four seconds and then disappears as shown in Figure 5-11.


Pages:
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178