Friday, 21 November 2008     | Register
Download the Complete Source Code for this Example
 TitleModified DateSize (Kb) 
ASP.NET DatePicker Example Application25/01/200712.32Download
ASP.NET DatePicker Example Usage

1. Add the Eclipse Web Solutions ASP.NET DatePicker Control to the Visual Studio toolbox.

 

Right click the Visual Studio toolbox and select 'Choose Items...'. Browse to and select the DLL file provided by Eclipse Web Solutions.

Add to toolbox

Add to toolbox

 

 

2. Create a page to include the ASP.NET DatePicker Control.

 

The DatePicker can be dragged onto any ASP.NET 2.0 page or user control, however, this example demonstrates using the DatePicker with Microsoft AJAX. In this simple example selecting a date using the DatePicker causes the selected date to be displayed in a label via an asynchronous postback. The significant portion of the code behind follows:

        <asp:UpdatePanel ID="pnlDatePicker" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <ews:DatePicker ID="DatePicker1" runat="server" 
                  OnSelectionChanged="DatePicker1_SelectionChanged" /> ContentTemplate> asp:UpdatePanel> <br /> <asp:UpdatePanel ID="pnlLabel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server">asp:Label> ContentTemplate> asp:UpdatePanel>
And in the code behind the DatePicker's SelectionChanged event is handled to update the label:

    protected void DatePicker1_SelectionChanged(object sender, EventArgs e)
    {
        Label1.Text = DatePicker1.DateValue.ToShortDateString();
        pnlLabel.Update();
    }
3. Run the application!
Copyright 2007 by Eclipse Web Solutions Pty Ltd   |  Privacy Statement  |  Terms Of Use