Prev | Current Page 793 | Next

Rob Cameron and Dale Michalk

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

Separator, false, null);
items.Add(separator);
}
LiveSearchService.Result searchResultItem = null;
if (dataBind == true)
{
searchResultItem = result.Responses[0].Results[i];
}
ResultItem item = CreateResultItem(i,
itemType, dataBind, searchResultItem);
items.Add(item);
// swap between item and alternatingitem types
if (itemType == ResultItemType.Item)
itemType = ResultItemType.AlternatingItem;
else
itemType = ResultItemType.Item;
}
// display pager if allowed by user and if results
// are greater than a page in length
if (DisplayPager == true && TotalResultsCount > PageSize)
{
ResultItem pager = CreatePagerResultItem();
items.Add(pager);
}
if (FooterTemplate != null)
{
ResultItem footer = CreateResultItem(-1, ResultItemType.Footer,
false, null);
items.Add(footer);
}
}
If we are in data-binding mode based on the passed-in Boolean parameter, the Result
control examines the LiveSearchService.SearchResponse instance linked to the DataSource
property of itself. DataSource is strongly typed in the implementation of Result to prevent
someone from accidentally assigning a DataSet or other type of collection to it.
614 CHAPTER 12 ?–  B U ILDING A COMPLEX CONTROL
///
/// Data source which takes a SearchResponse to build display.


Pages:
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805