Basic Date Picker Documentation

BDPLite.SelectedDate Property

Gets or sets the current selected date of the calendar. Accepts and returns a DateTime object.

[Visual Basic]
Overrides Public Property SelectedDate As Date
[C#]
public override System.DateTime SelectedDate {get; set;}

Property Value

A DateTime object that represents the selected date. The default value is DateTime.MinValue (Null).

Remarks

Use the SelectedDate property to determine the selected date of the BDPLite control.

The SelectedDate property is set using a DateTime object.

A post back event is NOT raised when the user navigates between months.

Note   The BDPLite control does not have a AutoPostBack property and can not handle OnSelectionChanged events. Please see BasicDatePicker for these features.

Example

[Visual Basic, C#] The following example demonstrates how to use the SelectedDate property to get the selected date from the BDPLite.

[Visual Basic]
<%@ Page Language="VB" AutoEventWireup="true" %>
<%@ Register TagPrefix="bdp" Namespace="BasicFrame.WebControls" Assembly="BasicFrame.WebControls.BasicDatePicker" %>
<html>
 <head>
    <title>BDP Lite SelectedDate Example</title>
     <script runat="server">
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not IsPostBack Then
                ' Set SelectedDate to Today
                BDPLite1.SelectedDate = DateTime.Today
            End If
        End Sub
        
        Sub Button_Click(sender As Object, e As EventArgs) 
            Dim tempDate As DateTime = Me.BDPLite.SelectedDate
            tempDate = TempDate.AddDays(7)
            Response.Write("One week from Today is " + tempDate.ToString("d-MMM-yyyy"))
        End Sub    
     </script>
 </head>
 <body>
     <form runat="server">
         <h3>BDP Lite SelectedDate Example</h3>
         <bdp:bdplite ID="BDPLite1" runat="server"></bdp:bdplite>
         <p><asp:Button 
                 ID="Button1" 
                 runat="server" 
                 text="Submit" 
                 onclick="Button_Click"></asp:Button></p>
     </form>
 </body>
</html>

[C#]
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register TagPrefix="bdp" Namespace="BasicFrame.WebControls" Assembly="BasicFrame.WebControls.BasicDatePicker" %>
<html>
 <head>
    <title>BDP Lite SelectedDate Example</title>
     <script runat="server">
        void Page_Load(Object sender, EventArgs e)
        {
            // Set SelectedDate to Today
            if (!IsPostBack)
                this.BDPLite1.SelectedDate = DateTime.Today;
        }

        private void Button_Click(object sender, EventArgs e)
        {
            DateTime tempDate = this.BDPLite1.SelectedDate;
            tempDate = tempDate.AddDays(7);
            Response.Write("One week from Today is " + tempDate.ToString("d-MMM-yyyy"));
        }    
     </script>
 </head>
 <body>
     <form runat="server">
         <h3>BDP Lite SelectedDate Example</h3>
         <bdp:bdplite ID="BDPLite1" runat="server"></bdp:bdplite>
         <p><asp:Button 
                 ID="Button1" 
                 runat="server" 
                 text="Submit" 
                 onclick="Button_Click"></asp:Button></p>
     </form>
 </body>
</html>

See Also

BDPLite Class | BasicFrame.WebControls Namespace | SelectedDateFormatted