|
Tutorial - Handling postbacks
|
| | |
On postback, to get the selected date from the calendar, use SelectedDate property.
By default, calendar doesn't automatically post back when date is selected.
To make it post back automatically, set AutoPostback property to true.
You can know when the selected date of the calendar has changed by defining
a DateChanged event handler. See examples below.
| | |
Example
In this example, calendar doesn't automatically post back, but instead selected date is processed on button click.
ASP.NET
<script runat="server"> void Button_Submit(object o, EventArgs e) { DateTime selectedDate = myCal.SelectedDate; } </script> <obout:Calendar runat="server" id="myCal"></obout:Calendar> <ASP:Button runat="server" OnClick="Button_Submit"></ASP:Button> | | |
Example
In this example, calendar automatically posts back when date is selected.
Selected date is processed on DateChanged event.
<< | Friday, July 25, 2008 | >> |
|
|
ASP.NET
<script runat="server"> void Date_Changed(object o, EventArgs e) { DateTime selectedDate = myCal.SelectedDate; } </script> <obout:Calendar runat="server" id="myCal" AutoPostBack="true" OnDateChanged="Date_Changed"> </obout:Calendar>
C#
myCal.AutoPostBack = true; myCal.DateChanged += new EventHandler(this.Date_Changed);
VB.NET
myCal.AutoPostBack = True AddHandler myCal.DateChanged, AddressOf Me.Date_Changed | | |
| "We’re very happy customers. Thanks for the great turnaround time and attention with your tech support.Thanks." |
Chris LoPresto |
| Microdesk, Inc. |
| | |
|