Prev | Current Page 843 | Next

Rob Cameron and Dale Michalk

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

Controls.Add(lit);
}
private Result GetResultControl(Control container)
{
ResultItem itemControl = (ResultItem)container.Parent;
Result resultControl = (Result)itemControl.Parent;
return resultControl;
}
private void BindResultHeader(object source, EventArgs e)
{
Label header = (Label)source;
Result resultControl = GetResultControl(header);
StringBuilder section = new StringBuilder();
// get ResouceManager for localized format strings
ResourceManager rm = ResourceFactory.Manager;
668 CHAPTER 13 ?–  PACKAGING AND DEPLOYMENT
// Searched for:
section.Append(
String.Format(
rm.GetString("ResultStatusTemplate.SearchFor"),
resultControl.Query));
section.Append("
");
// Result - of about
// records
// (accounting for zero based index)
section.Append(
String.Format(
rm.GetString("ResultStatusTemplate.ResultAbout"),
((resultControl.PageNumber - 1) * (resultControl.PageSize)) + 1,
resultControl.PageNumber * (resultControl.PageSize),
resultControl.TotalResultsCount));
section.Append("  ");
header.Text = section.ToString();
}
}
}
ResultItemTemplate provides the default display for each item from the search results. The
control content added inside the container includes a hyperlink displaying the title field Live
Search Result and providing a hyperlink to the value of its URL field.


Pages:
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855