AJAX, short for Asynchronous JavaScript And XML, isn’t a technology but rather a grouping of technologies. AJAX uses a communication technology (typically SOAP and XML) to send and receive an asynchronous request/response to the server, and then leverages presentation technologies (JavaScript, DOM, HTML, and CSS) to process the response. Applications using AJAX are legitimate today, because most browsers support the necessary technology.

First thing we need to do is to import the AJAX namespace from Ajax.DLL.The Ajax namespace contains Ajax.dll encapsule Asynchronous Javascript and XML in Bin folder. This is an combination of Javascript and XML. The data is transfered in the form of XML.

In this tutorial, the only configuration step beyond that is to add the following code in the web.config file, inside the element.

In order to make server-side functions available through JavaScript, two things must be done. First, the function or functions in question must be marked with the Ajax.AjaxMethodAttribute. Second, the class containing these functions must be registered through a call to Ajax.Utility.RegisterTypeForAjax during the page load event. Then we use GetData() even of btnGetData and display() event of DropDownList to do the work. The button btnGetData is a html button. It display employee data without page post-back. When chose a particular record in the Dropdownlist, the employee name and employee ID will be displayed in the label.

The code below can go in the tags of the ASPX page:

The front end AjaxDataSearchVB.aspx page looks something like this:

Register Ajax in PageLoad and get data from the employee table of Database.

The flow for the code behind page is as follows.

Download Source Files