Items)
{
if (item.ItemType == ResultItemType.Header)
{
if (HeaderStyle != null)
item.ApplyStyle(HeaderStyle);
}
else if (item.ItemType == ResultItemType.Status)
{
CHAPTER 12 ?– BUILDING A COMPLEX CONTROL 619
if (StatusStyle != null)
item.ApplyStyle(StatusStyle);
}
else if (item.ItemType == ResultItemType.Item)
{
if (ItemStyle != null)
item.ApplyStyle(ItemStyle);
}
else if (item.ItemType == ResultItemType.AlternatingItem)
{
if (AlternatingItemStyle != null)
item.ApplyStyle(AlternatingItemStyle);
else if (ItemStyle != null)
item.ApplyStyle(ItemStyle);
}
else if (item.ItemType == ResultItemType.Separator)
{
if (SeparatorStyle != null)
item.ApplyStyle(SeparatorStyle);
}
else if (item.ItemType == ResultItemType.Pager)
{
if (PagerStyle != null)
{
Pager pager = (Pager) item.Controls[0];
pager.ApplyStyle(PagerStyle);
}
}
else if (item.ItemType == ResultItemType.Footer)
{
if (FooterStyle != null)
item.ApplyStyle(FooterStyle);
}
}
}
Because we know there is only one instance of the Pager server control stored as a ResultItem,
we apply PagerStyle directly to this instance, as shown in the preceding code. Listing 12-6
shows the full source for the Result control.
Listing 12-6. The Result.cs Class File
using System;
using System.
Pages:
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813