Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Input / Clearing the content of date input box

Clearing the content of date input box

Article Info

Rating: 4

Article information

Article relates to

RadInput v1.x

Created by

Paul

Last modified

March 07, 2008

Last modified by

Maria Ilieva

HOWTO
Clear the content of the date input box.

DESCRIPTION
Sometimes you may need to clear the RadDateInput value and leave the input field blank.



SOLUTION
The code below shows how to clear the content of the date input box by clicking on a button.

ASPX:

<form id="Form1" method="post" runat="server">
   <radi:RadDateInput id="RadDateInput1" Runat="server" SelectedDate="2006-01-31" AllowEmpty="True"></radi:RadDateInput>
   <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
  </form>


Code-behind:

private void Button1_Click(object sender, System.EventArgs e)
  {
   RadDateInput1.SelectedDate = RadDateInput1.MinDate;
  }

 
  SOLUTION
The code below shows how to clear the content of the date input box by clicking on a button.

ASPX:

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <telerik:RadDateInput ID="RadDateInput1" SelectedDate="2007-01-31" runat="server">
            </telerik:RadDateInput>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>
    </form>

Code-behind:

protected void Button1_Click(object sender, System.EventArgs e)
   
        {
            RadDateInput1.SelectedDate = null;
        }
 

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.