Two men with a computer and a tablet

Create a Custom Control to Wrap the Google JSON/ATOM Custom Search API, Part 2

Add design-time features to the GoogleRestApiControl custom control created in part 1

In Part 1 of this article, we learned the basics of the Google JSON/ATOM Custom Search API and also developed an ASP.NET custom server control to wrap the API for easy use in our web applications. In this part we will add design-time features to the GoogleRestApiControl custom control, such as Smart-tag and custom drop-down lists. In the process, we will discuss how to create a custom control designer, a custom action list, and a custom type converter for our custom control.

As a quick recap, the properties and methods of the GoogleRestApiControl are listed again in Figure 1.

Property / Method Description
Figure 1: Properties and methods of GoogleRestApiControl
Url Indicates the Google URL for making REST calls. Though this URL is fixed we still make it as a property to accommodate any changes at later time.
ApiKey An API Key required to use Google REST API.
CustomSearchEngineId A unique ID of the custom search engine that you wish to use for searching.
SearchCriteria Any search criteria string that you normally enter in search box.
LanguageFilter By default search returns matching content without any language restriction. You can restrict the results to a particular language using this property.
SafeSearchOption Governs safety level of the results. Possible values are Off, High and Medium.
FilterDuplicateResults By default duplicate content is filtered but you can change the default using this property.
SearchResultFormat The format in which search results are returned. Possible formats are JSON and ATOM.
ClientCallbackName If you wish to deal with search results from client side script rather than server side code then you can specify a JavaScript function that handles the results.
GetSearchResults() This method returns search results as a string. The string can contain JSON or ATOM data depending on the format specified using the SearchResultFormat property.
GetSearchResultsAsSyndicationItems() Returns search results as ATOM feed items.
GetClientScriptBlock() Returns a client side