RadDateTimePicker EmptyText

9 posts, 1 answers
  1. Mike
    Mike avatar
    74 posts
    Member since:
    Mar 2013

    Posted 02 Apr 2014 Link to this post

    Is it possible to set the "placeholder" text or "EmptyText" of a RadDateTimePicker and/or RadDatePicker?  The form I'm designing is utilizing the EmptyText property on the controls, except my DateTimePicker and DatePicker.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2014 in reply to Mike Link to this post

    Hi Mike,

    Please try the following JavaScript code snippet to achieve your scenario.

    JavaScript:
    $('.riTextBox').val("Empty Message");

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mike
    Mike avatar
    74 posts
    Member since:
    Mar 2013

    Posted 03 Apr 2014 in reply to Shinu Link to this post

    I tried this, however I have three other Telerik text boxes on the page as well as the date/time picker and a date picker.  Now they all have "Empty Message" instead of the values I set in the EmptyText property.  The issue I'm having is the date/time picker and the date picker do not have the EmptyText property.  How can I set the placeholder text [empty text value] on just the date/time picker and the date picker without affecting the other text boxes?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Apr 2014 in reply to Mike Link to this post

    Hi Mike,

    Please try the following code snippet to achieve your scenario.

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
    </telerik:RadTextBox>
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    </telerik:RadDatePicker>

    JavaScript:
    <script type="text/javascript">
        function pageLoad() {
            $('#RadDatePicker1_dateInput').val("Empty Message");
        }
    </script>

    Thanks,
    Shinu.
  6. Mike
    Mike avatar
    74 posts
    Member since:
    Mar 2013

    Posted 09 Apr 2014 in reply to Shinu Link to this post

    Thanks for the response, however my text still isn't being displayed.

    My code:
    <telerik:RadDatePicker runat="server" ID="radPackageDate">
        <Calendar>
            <SpecialDays>
                <telerik:RadCalendarDay Repeatable="Today">
                    <ItemStyle BackColor="LightGray" Font-Bold="True" BorderStyle="Solid" BorderColor="Black" BorderWidth="1px"></ItemStyle>
                </telerik:RadCalendarDay>
            </SpecialDays>
        </Calendar>
    </telerik:RadDatePicker>

    My JS:
    function pageLoad() {
        $('#radPackageDate_dateInput').val("Package Date");
    }

    Am I missing something?
  7. Answer
    Krsnaraja
    Krsnaraja avatar
    9 posts
    Member since:
    Aug 2007

    Posted 09 Apr 2014 in reply to Mike Link to this post

    Hi,

    Try below modified JavaScript code.

    JS:
    function pageLoad() {
            //  $('#radPackageDate_dateInput').val("Package Date");
            $find('radPackageDate').get_dateInput().set_textBoxValue('Package Date');
    }

    Thanks,
    Krishna Raja
  8. Mike
    Mike avatar
    74 posts
    Member since:
    Mar 2013

    Posted 11 Apr 2014 in reply to Krsnaraja Link to this post

    That worked, thanks!
  9. Courtlandt Harris
    Courtlandt Harris avatar
    6 posts
    Member since:
    Oct 2009

    Posted 21 Aug 2014 Link to this post

    I only post this because this entire thread sent me down a rabbit trail.  If, for some reason you wanted to accomplish this task via javascript, a far more effective method to accomplish EmptyMessage functionality would be to set the actual empty message of the text box.  If you just set the value as suggested above, it will disappear as soon as the control gains and looses focus.

    function pageLoad() {      
        $find("<%= radPackageDate.ClientID%>").get_dateInput().set_emptyMessage('Package Date');
    }


    However, this is far more cleanly handled server-side by just using:

    RadPackageDate.DateInput.EmptyMessage = "Package Date"
  10. Jerry
    Jerry avatar
    7 posts
    Member since:
    Jun 2008

    Posted 12 Nov 2014 Link to this post

    You can simply set the DateInput-EmptyMessage property. For example:

                   
    <telerik:RadDatePicker ID="rdpBirthdate" runat="server"
                        DateInput-EmptyMessage="Date of Birth MM/DD/YYYY" Skin="Default" />

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017