Basic Date Picker Documentation

BasicDatePicker.Clear Method 

Clears the SelectedDate by setting the SelectedDate DateTime.MinValue (Null)).

[Visual Basic]
Public Sub Clear()
[C#]
public void Clear();

Remarks

Clears the SelectedDate value.

Example

[Visual Basic, C#] The following example demonstrates how to use the Clear Method to clear the contents of the TextBox.

[Visual Basic]
<%@ Page Language="VB" AutoEventWireup="true" %>
<%@ Register TagPrefix="bdp" Namespace="BasicFrame.WebControls" Assembly="BasicFrame.WebControls.BasicDatePicker" %>
<html>
 <head>
    <title>Basic Date Picker Clear() 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
                this.BasicDatePicker1.SelectedDate = DateTime.Today
            End If
        End Sub
        
        Sub Selection_Change(sender As Object, e As EventArgs) 
            Response.Write("You picked: " + Me.BasicDatePicker1.SelectedDateFormatted)
        End Sub
        
        Sub Button_Click(sender As Object, e As EventArgs) 
            Me.BasicDatePicker1.Clear()
            Response.Write("You cleared the date")
        End Sub    
     </script>
 </head>
 <body>
     <form runat="server">
         <h3>Basic Date Picker Clear() Example</h3>
         <p><bdp:BasicDatePicker 
             ID="BasicDatePicker1" 
             OnSelectionChanged="Selection_Change" 
             AutoPostBack="true" 
             runat="server"></bdp:BasicDatePicker></p>
         <p><asp:Button 
                 ID="Button1" 
                 runat="server" 
                 text="Clear" 
                 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>Basic Date Picker Clear() Example</title>
     <script runat="server">
        void Page_Load(Object sender, EventArgs e)
        {
            // Set SelectedDate to Today
            if (!IsPostBack)
                this.BasicDatePicker1.SelectedDate = DateTime.Today;
        }
        
        private void Selection_Change(object sender, EventArgs e)
        {
            Response.Write("You picked: " + this.BasicDatePicker1.SelectedDateFormatted);
        }

        private void Button_Click(object sender, EventArgs e)
        {
            this.BasicDatePicker1.Clear();
            Response.Write("You cleared the date");
        }    
     </script>
 </head>
 <body>
     <form runat="server">
         <h3>Basic Date Picker Clear() Example</h3>
         <p><bdp:BasicDatePicker 
             ID="BasicDatePicker1" 
             OnSelectionChanged="Selection_Change" 
             AutoPostBack="true" 
             runat="server"></bdp:BasicDatePicker></p>
         <p><asp:Button 
                 ID="Button1" 
                 runat="server" 
                 text="Clear" 
                 onclick="Button_Click"></asp:Button></p>
     </form>
 </body>
</html>

See Also

BasicDatePicker Class | BasicFrame.WebControls Namespace | IsNull | NullDateText