This tutorial shows how easy it is to use AJAX to make a Calendar control more dynamic by allow the selected date to be transferred to a textbox for without using PostBack. VB version.

This tutorial was created with Microsoft’s ASP.NET AJAX Extensions for VS.NET 2005, which can be downloaded at this link.
This brief article will show how easy it is to make the calendar control very dynamic and usable, by implementing AJAX to input the selected date into a textbox for submission and make it easier to read.

First, we create an ‘AJAX-Enabled Web Site’ in Visual Studio .NET
Which will give us our ScriptManager tag, and also the AJAX assembly references in the Web.config:

We create a TextBox control and a Calendar control:

Note that the Calendar has a OnSelectionChanged attribute, and that both the controls are within the UpdatePanel tags. This will ensure that these controls are refreshed when the trigger is activated.

The only code we need is below. This is executed when the selection of the calendar control is changed (when the user clicks on a new date). When this happens, the method PutDateInBox is called and the date is input into the textbox control, from the calendar control.

Download Source Files