This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker EmptyText

8 Answers 493 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 02 Apr 2014, 03:34 PM
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.

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Apr 2014, 03:23 AM
Hi Mike,

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

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

Thanks,
Shinu.
0
Mike
Top achievements
Rank 1
answered on 03 Apr 2014, 09:54 PM
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?
0
Shinu
Top achievements
Rank 2
answered on 04 Apr 2014, 03:13 AM
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.
0
Mike
Top achievements
Rank 1
answered on 09 Apr 2014, 06:02 PM
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?
0
Accepted
Krishnaprabhuraja
Top achievements
Rank 1
answered on 10 Apr 2014, 02:45 AM
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
0
Mike
Top achievements
Rank 1
answered on 11 Apr 2014, 11:06 PM
That worked, thanks!
0
Courtlandt Harris
Top achievements
Rank 1
answered on 21 Aug 2014, 07:50 PM
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"
0
Jerry
Top achievements
Rank 2
answered on 12 Nov 2014, 04:27 PM
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" />

‚Äč
Tags
Calendar
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Krishnaprabhuraja
Top achievements
Rank 1
Courtlandt Harris
Top achievements
Rank 1
Jerry
Top achievements
Rank 2
Share this question
or