The following is the actual code of
the GetHtml web method:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string GetHtml(string contextKey)
{
CHAPTER 8 ?– USING THE ASP.NET AJAX CONTROL TOOLKIT (PART 2) 169
// A little pause to mimic a latent call
System.Threading.Thread.Sleep(250);
string value = (contextKey == "U") ?
DateTime.UtcNow.ToString() :
String.Format("{0:" + contextKey + "}", DateTime.Now);
return String.Format("
{0}", value);
}
The contextKey variable contains the value of the selected radio button in this case
and is used to determine the selected formatting for the date. You can see the DynamicPopulate.
aspx page in Figure 8-3.
Figure 8-3. DynamicPopulate extender displaying the date fetched from a web service
One last point to notice about this example is that during the update of the panel bar,
the circular animating GIF image informs the user of the update status of this control.
This is accomplished by setting the UpdateCssClass property of the DynamicPopulate extender
in which you can have animating GIFs along with any other desired CSS code to have
the proper decoration for the target control during the update.
Pages:
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245