radfilter date only /time only

6 posts, 0 answers
  1. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 30 May 2013 Link to this post

    When using radfilter in radwindow like the following example, This radwindow/radfilter is shared my all the gird filter through my site.

    http://demos.telerik.com/aspnet-ajax/filter/examples/filterinradwindow/defaultcs.aspx

    If I have GridDateTimeColumn on the grid and have TimePicker and DatePicker as PickerType for separate column, On the filter, how can I check the GridDateTimeColumn PickerType to show date only (no time icon) when PickerType is DatePicker and show time only ( no date icon) when PickerType is TimePicker ?

    Thanks

  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 04 Jun 2013 Link to this post

    Hi,

    I have assembled a sample page showing the desired functionality implemented. The idea is to subscribe to RadFilter FieldEditorCreated event and set the editor PickerType value depending on the column PickerType as shown below.
    protected void RadFilter1_FieldEditorCreated(object sender, RadFilterFieldEditorCreatedEventArgs e)
    {
        if (e.Editor.FieldName == "DateTime")
        {
            RadFilterDateFieldEditor editor = e.Editor as RadFilterDateFieldEditor;
            string pickerTypeAsString = (RadGrid1.MasterTableView.GetColumn("DateTime") as GridDateTimeColumn).PickerType.ToString();
            editor.PickerType = (RadFilterDateFieldEditorPickerType)Enum.Parse(typeof(RadFilterDateFieldEditorPickerType), pickerTypeAsString);
        }
    }

    Regards,
    Antonio Stoilkov
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marcus
    Marcus avatar
    30 posts
    Member since:
    Feb 2009

    Posted 25 Jun 2013 Link to this post

    Umm ... Antonio:

    RadFilterDateFieldEditor class (-> editor) does not contain a definition for "PickerType".
    Also: what namespace is RadFilterDateFieldEditorPickerType contained in?

    using v2013.1.220.40

    Thx in advance!
    M.
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Jun 2013 Link to this post

    Hi Marcus,

    The RadFilterDateFieldEditorPickerType is contained in the Telerik.Web.UI namespace. I have tried the same code which works fine in the latest version(2013.2.611.40) of Telerik RadControls for ASP.NET AJAX whereas it didn't worked in the previous release like what you described. So update your RadControls to the latest version.

    Thanks,
    Shinu.
  6. Marcus
    Marcus avatar
    30 posts
    Member since:
    Feb 2009

    Posted 02 Jul 2013 Link to this post

    Shinu,

    thx for your reply. It seems I don't have access to the latest build (subscription expired in June).
    Is there a way to do this client-side? I though I saw an example for that somewhere, but I can't find it anymore.

    Thx in advance!
    M.
  7. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 05 Jul 2013 Link to this post

    Hi,

    In order to achieve your scenario without the latest version you could create a custom RadFilter editor and in the InitializeEditor place a RadDatePicker. The help article below describes how a RadFilter custom editor could be created.

    Regards,
    Antonio Stoilkov
    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