This is a migrated thread and some comments may be shown as answers.
Filter FieldEditors only show date
6 Answers 51 Views
This is a migrated thread and some comments may be shown as answers.
Y
Top achievements
Rank 1
Y asked on 22 Nov 2011, 09:41 AM
Hi telerik,
   
    I want only show date in filter date fieldeditors,I set the PreviewDataFormat="yyyy-MM-dd" it not work. and I want not show the time picker ico.

<telerik:RadFilter ID="RadFilter1" runat="server" OnApplyExpressions="RadFilter1_ApplyExpressions">
                <FieldEditors>
                    <telerik:RadFilterDateFieldEditor DisplayName="Join Date" DataType="System.DateTime"
                        FieldName="approach_date" />
                </FieldEditors>
            </telerik:RadFilter>

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 22 Nov 2011, 11:08 AM
Hello,

You can try the following CSS to hide the time picker icon.

CSS:
<style type="text/css">
 .rcTimePopup
 {
   display:none ! important;
 }
</style>

Thanks,
Princy.
0
Y
Top achievements
Rank 1
answered on 16 Dec 2011, 09:15 AM
  Thanks very much!  But how set the input only show date?
0
JD.
Top achievements
Rank 1
answered on 05 Sep 2012, 04:34 AM
Hi Princy,

I liked your nice tip,  but like "Mr. Y", I have same query,  how to change input textbox to display date in 'dd-mmm-yyyy' format
and also make input field readonly so that user is forced to choose date.

Regards


PS:  I am not refering to "PreviewDataFormat".
0
Eyup
Telerik team
answered on 07 Sep 2012, 08:43 AM
Hi,

You could try the following approach:
function pageLoad() {
    var radFilter = $find("<%= RadFilter1.ClientID %>");
    var pickers = radFilter.get_element().getElementsByClassName("RadPicker");
    for (var i = 0; i < pickers.length; i++) {
        var picker = $find(pickers[i].firstElementChild.id);
        picker.get_timePopupButton().style.display = "none";
        picker.get_dateInput().get_element().readOnly = true;
        picker.get_dateInput().set_displayDateFormat("dd-MM-yyyy");
    }
}

I hope this will prove helpful.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
CaseNet
Top achievements
Rank 1
answered on 19 Jul 2013, 09:43 AM
Hello Mr Eyup,

I tried your way(javascript function).
At the first time the picker display correct DateFormat("dd-MM-yyyy"), however when I apply filter then dateformat  of picker is display with default format(MM/dd/yyyy 12:00 AM).
You have any ideas for this problem ?

Regards,
0
Eyup
Telerik team
answered on 24 Jul 2013, 08:36 AM
Hello,

You can use the following approach:
protected void RadFilter1_ExpressionItemCreated(object sender, RadFilterExpressionItemCreatedEventArgs e)
{
    RadFilterSingleExpressionItem singleItem = e.Item as RadFilterSingleExpressionItem;
    if (singleItem != null && singleItem.IsSingleValue)
    {
        RadDateTimePicker picker = singleItem.InputControl as RadDateTimePicker;
        if (picker != null)
        {
            picker.DateInput.ReadOnly = true;
            picker.TimePopupButton.Visible = false;
            picker.DateInput.DateFormat = "dd-MM-yyyy";
        }
    }
}

That should do the trick. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Y
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Y
Top achievements
Rank 1
JD.
Top achievements
Rank 1
Eyup
Telerik team
CaseNet
Top achievements
Rank 1
Share this question
or