Filter FieldEditors only show date

7 posts, 0 answers
  1. Y
    Y avatar
    17 posts
    Member since:
    Sep 2011

    Posted 22 Nov 2011 Link to this post

    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>
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Y
    Y avatar
    17 posts
    Member since:
    Sep 2011

    Posted 16 Dec 2011 Link to this post

      Thanks very much!  But how set the input only show date?
  5. JD.
    JD. avatar
    37 posts
    Member since:
    Aug 2012

    Posted 04 Sep 2012 Link to this post

    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".
  6. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 07 Sep 2012 Link to this post

    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.
  7. CaseNet
    CaseNet avatar
    2 posts
    Member since:
    Oct 2012

    Posted 19 Jul 2013 Link to this post

    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,
  8. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 24 Jul 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017