Prev | Current Page 781 | Next

Rob Cameron and Dale Michalk

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

Current.Server.UrlEncode(Query), true);
}
if (ResultControl.Length != 0)
{
// lookup the Result control we are linked to
// and get the PageSize property value
Result resControl = (Result)Page.FindControl(ResultControl);
if (resControl == null)
resControl = (Result)this.NamingContainer.FindControl(ResultControl);
if (resControl == null)
throw new ArgumentException("Either a Result control is not set on the " +
"Search Control or the Result control is not located on the " +
"Page or at the same nesting level as the Search control.");
SourceRequest[] sourceRequests = new SourceRequest[1];
sourceRequests[0] = new SourceRequest();
sourceRequests[0].Count = resControl.PageSize;
//Specifies the number of results to return from offset
sourceRequests[0].Source = SourceType.Web;
//new search, always reset
sourceRequests[0].Offset = 0; //start index for returned results
sourceRequests[0].ResultFields = ResultFieldMask.All |
ResultFieldMask.DateTime;
// get search results from Live Search WCF service proxy
SearchResponse searchResponse =
SearchUtility.SearchLiveSearchService(
Query, sourceRequests);
// raise search results for any interested parties as well
OnLiveSearchSearched(new LiveSearchSearchedEventArgs(searchResponse));
CHAPTER 12 ?–  BUILDING A COMPLEX CONTROL 603
// databind search results with the Result control
// we are linked with
resControl.


Pages:
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793