You can add a custom event handler to a date field that will be triggered after a date has been selected in the Form designer calendar control. To do this:
-
Open the form in .NET code edit mode.
-
In the Page_Load event, set the AutoPostBack property to
TRUE
on the calendar pop-up.Example for a date input with the ID
DATE
inside a section with the IDREQUEST
:REQUEST_DATE_CAL.AutoPostBack = true;
-
Add the DateChanged event handler.
Sample code:
protected void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
if(!IsPostBack)
{
// Set the obligatory AutoPostBack property on the CalendarPopup
REQUEST_DATE_CAL.AutoPostBack = true;
}
// Add the DateChanged event handler
REQUEST_DATE_CAL.DateChanged += REQUEST_DATE_CAL_DateChanged;
}
protected void REQUEST_DATE_CAL_DateChanged(object sender, EventArgs e)
{
// Get the selected date (DateTime) like so: **REQUEST_DATE_CAL.SelectedDate**
}