DatePicker with regular textbox

4 posts, 0 answers
  1. Li Zhou
    Li Zhou avatar
    23 posts
    Member since:
    Dec 2003

    Posted 07 Jul 2010 Link to this post

    For some reason, I cannot use DatePicker control.  I can use a regular textbox, plus a caledar icon.  I want to achieve the same thing as DatePicker, by clicking that icon, it shows a calendar, when a date is slected, the date is entered into the textbox.

    Is that a easy way to do this?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Jul 2010 Link to this post


    One way to achieve the functionality is using a calendar control and setting the visibility from client side on clicking the popup image. Check the following code:

        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <img src="../../Images/popup.gif" onclick="openPopup();" />
        <telerik:RadCalendar ID="RadCalendar1" runat="server">
            <ClientEvents OnDateSelected="OnDateSelected" />

    client code:
    <script type="text/javascript">
        function pageLoad() {
            var calendar = $find('<%= RadCalendar1.ClientID %>');
            calendar.set_visible(false); // Initially set the visibility as false
        function OnDateSelected(sender, args) {
            var dt = new Date();
        function openPopup() {
            var calendar = $find('<%= RadCalendar1.ClientID %>');
            // Read the textbox value and set the Date of Calendar

  3. Li Zhou
    Li Zhou avatar
    23 posts
    Member since:
    Dec 2003

    Posted 08 Jul 2010 Link to this post

    Thanks, that works well
  4. Ron Boehm
    Ron Boehm avatar
    20 posts
    Member since:
    Dec 2009

    Posted 16 Jul 2010 Link to this post

    The solution provided is non-functional for me.

    I am able to remove the textbox and connect the calendar to the combobox.

    The problems are:
        The calendar icon is in a dev and puts extra space around it in the GUI.
        On startup, the calendar flashes on and then off and the space it took up is not removed,
            so there is a big whole in my GUI.

Back to Top