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

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Add(footer);
}
Creating the Hyperlink Section
The middle of the code for the CreateControlHierarchy method adds the items in the menu
using the ASP.NET HyperLink control. The data for the process is provided by the ArrayList
collection exposed by the private menuData field that we instantiated in the constructor for our
control.
The first task in building each hyperlink is iterating through the menuData ArrayList. We
use a loop and a counter to help us track when we need to apply the MenuSeparatorTemplate
template to separate the hyperlinks. The loop drives retrieval of the instances of the MenuItemData
class from the collection and the execution of the CreateMenuItem helper method:
int count = menuData.Count;
for (int index = 0; index < count; index++)
{
MenuItemData itemdata = (MenuItemData) menuData[index];
CreateMenuItem(itemdata.Title, itemdata.Url,itemdata.ImageUrl, itemdata.Target);
if (index != count-1)
{
if (SeparatorTemplate != null)
{
SeperatorTemplateContainer separator = new SeperatorTemplateContainer ();
SeparatorTemplate.InstantiateIn(separator);
Controls.Add(separator);
}
else
{
Controls.Add(new LiteralControl(" | "));
}
}
}
CHAPTER 6 ?–  SERVER CONTROL TEMPLATES 261
CreateMenuItem creates an ASP.


Pages:
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6