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 313 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"

Inside the Update method, we
need to determine the active tab and execute the corresponding method:
private void Update(int selectedTabIndex)
{
switch (selectedTabIndex)
{
case 0: //Basic Quote
lblBasicQuote.Text = GetBasicQuote(txtTicker.Text.Trim());
break;
case 1: //Price History
GetPriceHistory(txtTicker.Text.Trim());
break;
case 2: //Analytics
GetAnalytics(txtTicker.Text.Trim());
break;
}
}
A simple switch statement does the job here. Based on the active tab index, the
appropriate method is called to render the tab. Three methods are called here, one for
each of three tabs that all have the same signature: one parameter that takes in the stock
ticker entered by the user in the TextBox control. The individual methods, GetBasicQuote,
GetPriceHistory, and GetAnalytics, are covered a little later in this chapter.
With that out of the way, let??™s take a closer look at how to obtain the required data
and implement the individual sections of this application.
Creating Basic Company and Quote Information
Flash-db.com provides several hosted web services free of charge.


Pages:
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325