jQuery UI and autocomplete TextBox

This article demonstrates how to add autocomplete feature to asp.net TextBox, exposing autocomplete values via WebService.

The Autocomplete widget is one of the widgets provided in jQuery UI and provides suggestions while you type into the field. jQuery UI is a free widget and interaction library built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.

First let’s create the webservice that will generate some random values.

As you see in comments, please make sure [System.Web.Script.Services.ScriptService] is not commented otherwise you’ll have issues.

Below the code that do our job:

Pretty Date Formating

You want to display pretty, nicely formatted dates in your C# program. For example, you need to show “1 hour ago” or “1 minute ago”, instead of seconds.

Source here