Wednesday, January 20, 2010

AutoComplete Search

Auto Complete Search is a good to have functionality to ease the search for a given context . Before deciding on the approach, lets first examine the data source from where the auto complete list needs to be populated.

case i) Data is available in the web page already and needs to be listed upon search.

In this case instead of caching the dataset or making the page heavy by storing the dataset values to maintain across postbacks, the suggestion list to be displayed can be built as a JSON structure.

JSON is a format in which the values are stored and is very easily accessible in the form of objects in the client side.

case ii) Data is not pre-fetched and needs to be rendered on the fly. In this case a definite server side call is required either synchronously/asynchronously. Here we can make use of the ASP.Net autocomplete feature. It requires a reference to the Ajax Extender control toolkit.
Here we necessarily need to call a web method with the default parameters mentioned in the syntax including the casing. So what about customization here?
Well, we can address it using the bridge method with the default parameters and then calling the custom method with the required set of custom parameters from there.





No comments: