GridDateTimeColumn

20 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 01 Feb 2010 Link to this post

    Is there any way to have GridDateTimeColumn filtering work without having to custom code anything?  I get the nice datepicker, but it never works out of the box (I assume becasue of the time being part of the datetime type?)


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Feb 2010 Link to this post

    Hi,

    GridDateTimeColumn  handles filtering automatically,but I guess you want to filter using the time criteria as well.You can set the PickerType to DateTimePicker which will enable you to filter by date and time.

    ASPX:
    <telerik:GridDateTimeColumn AutoPostBackOnFilter="false"  PickerType="DateTimePicker" UniqueName="DateTimeColumn" DataField="date"
    </telerik:GridDateTimeColumn>  
     

    Hope this helps.

    Thanks,
     Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 02 Feb 2010 Link to this post

    Hey Princy,
      Well actually I've never had the DateTimeColumn every work automatically bound to a datatime DB col.  I just want to have it show all items on Jan 9th 2010 (for example)...so I pick the date from the box and want it to AutoPostBackOnFilter to give me those dates, but it never seems to do anything.

    *Edit:
    Here's the col definition
    <telerik:GridDateTimeColumn DataField="Modified" DataType="System.DateTime"  AllowFiltering="true" AllowSorting="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                HeaderText="Modified" SortExpression="Modified" UniqueName="Modified" PickerType="DatePicker" > 
            </telerik:GridDateTimeColumn> 

    So if I choose Jan 9th 2010 from the box, nothing happens, then if I choose equals to, I get no records (when there's actually two)....so Im assuming it because of the time being factored into the equation...when if I specify just use date, the GridDateTimeColumn should only be filtering based on the date...

    Steve
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 04 Feb 2010 Link to this post

    Hello Steve,

    Please examine the following thread:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/date-filter-improvements.aspx

    I hope this helps

    Best regards,
    Daniel
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Feb 2010 Link to this post

    That does explain it...however if I specify a PickerType of datepicker on the column, then it should automatically assume that I do not want to filter on time, and internally handle that situation.  I can't imagine i'm the only one who needs the data of a datetime and auto filtering (i.e no extra filter code) on the column. 


    Can I get that as a feature request?
  7. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 12 Feb 2010 Link to this post

    Hello Steve,

    Of course, you are not the only one asking for this functionality. I passed your feature request to our developers but I'm afraid there is no way to implement it at this point.
    Excuse us for the inconvenience.

    Best regards,
    Daniel
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Feb 2010 Link to this post

    Is it really a feature request or a Bug that should be in PITS?  If the option is there to use only a DatePicker and it doesn't work because it's a DT column, thats a feature that currently is broken...

    Thanks for forwarding it :)  If possible try and get it into PITS as well
  9. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 18 Feb 2010 Link to this post

    Hello Steve,

    This is not a bug in RadGrid - actually it is a limitation "by design". Nothing is broken since this functionality works exactly in the way it was originally meant to behave.

    Best regards,
    Daniel
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 18 Feb 2010 Link to this post

    So it's by design to give us the option to filter by only date knowing full well it will fail because time is always a factor?
  11. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 24 Feb 2010 Link to this post

    Hello Steve,

    I understand, that you don't want to use the time part in your project, but this doesn't mean that everybody has the same requirements. Some clients prefer to filter by date, but considering the time part also. We can't just ignore the time part, only because the user has chosen to display the DatePicker. We wouldn't want to tamper with the data, coming from the data source - if anyone prefer to ignore the time part, he can easily achieve this manually at datasource level.
    Another option is to remove the "Equal To" filter option (which depends on the time) if this is suitable for you.

    I would like to underline that although I asked our developers to consider this functionality, this doesn't guarantee 100% that it will be approved. Of course, if they accept this functionailty, we will add it in PITS in a timely manner in order to make it publicly available.

    Thank you for your understanding.

    Kind regards,
    Daniel
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  12. Mark DeMichele
    Mark DeMichele avatar
    74 posts
    Member since:
    Oct 2005

    Posted 02 Mar 2010 Link to this post

    I was just reading this and want to put in my two cents.  I totally disagree with the Telerik response.

    If you using a Date only picker type than is makes sense that if I say, I want all records equal to "7/12/2009" that what I really mean is that I want all records from "7/12/2009 12:00am" to "7/12/2009 11:59.59pm".  There's no other logical assumption.

    It's only if I'm using a picker type that supplies a time where I want to do a true "Equals".

    The response, "this is by design and not a bug" sometimes get's very frustrating especially when there isn't a logical reason represented, unless I'm missing something.

    In my particular case, I want the user to see the times as well, but I don't think I need to give them the ability to filter on them.  It's too painful for them to do that.  The fact that they can see "all records changed on a day" is good enough, from there they can sort and view based on the times.

    I can't see any reason why someone would want to say "show me all records for this day (without time)" and nothing in return.

    Well, that's just my two cents and the only reason why I'm saying this is that I'm really starting to get frustrated working around tons of "by designed" features that I really consider "not by design", if you know what I mean.

    P.S.  I just tried changing the PickerType to DataTimePicker.  That's not very useful.  Not it's even worse.  What good is it to have this. It basically puts rounded times in for which Equals will almost never work.

    I'm already using my own custom descendant of RadGrid in order to get around other "design features".  Can you point me at the place in the code where I may be able to alter the functionality so that I can get it to filter on the entire day and not just:12:00am.
  13. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 05 Mar 2010 Link to this post

    Hello Mark,

    Thank you for your feedback.

    I understand your point of view and I have passed your feature request for future consideration.

    Best regards,
    Daniel
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  14. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 09 Apr 2012 Link to this post

    I have been searching the forum and see a lot of requests for this. Though you consider this not a bug (I agree), it is also not functional. Your Time control in this case is useless. Regarding this statement:

    "I'm already using my own custom descendant of RadGrid in order to get around other "design features". Can you point me at the place in the code where I may be able to alter the functionality so that I can get it to filter on the entire day and not just:12:00am."

    Is this possible? I too want to leave the time element in the grid but filter just on the date portion. In other words, is there a way to intercept the filter request and modify the SQL filter to achieve this result? I know how to write the SQL--I just want to know where I can accomplish this.

    Thanks!
  15. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 12 Apr 2012 Link to this post

    Hello Michael,

    It would be easier to use the approach demonstrated by Georgi in this forum post. Our developers will reconsider implementing time-independent filtering for one of the next releases of RadControls for ASP.NET AJAX.

    Best regards,
    Daniel
    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.
  16. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 12 Apr 2012 Link to this post

    Thanks! We prefer our solution because it allows us to display the time in the grid. In your example, it looks to me like you are chopping off the time in the display. We wanted to display the time but treat the query as a date only. Our solution allows that: http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-datetime-filtering.aspx 
  17. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Apr 2012 Link to this post

    Nice!  Thanks Michael

    @Telerik So while we have a solution, it's a bit of a pain to have to keep implementing.  I would bet if you put it out to a poll 99% of voters would say it SHOULD work the way we're expecting...by omitting the time

    At the very least make it work this way out of the box and put in a property to enable time filtering (which nobody will ever enable)
  18. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 12 Apr 2012 Link to this post

    I agree!

    In case this helps anybody else, we added logic for the <> >=, etc. This is kind of hacked together, but you get the drift:

    // for columns [AssignDate] and [ReferralDate], we need some help. We need to ignore the time element in the filter query
                string ret = filter;
                string assignDate = string.Empty;
                string referralDate = string.Empty;
     
                if (filter.Contains("([AssignDate]"))
                {
                    int index = filter.IndexOf("([AssignDate]");
                    int firstQuote = filter.IndexOf("'", index);
                    int lastQuote = filter.IndexOf("'", firstQuote + 1);
     
                    if ((firstQuote > -1) && (lastQuote > -1))
                    {
                        string stringToExcise = filter.Substring(index, lastQuote - index + 2);
     
                        if ((stringToExcise.Contains("IS NULL") == false) && (stringToExcise.Contains("IS NOT NULL") == false))
                        {
                            string dateToParse = filter.Substring(firstQuote + 1, lastQuote - firstQuote - 1);
                            DateTime dateTime = DateTime.Parse(dateToParse);
     
                            string filterModifier = string.Empty;
                            if (stringToExcise.Contains("<>"))
                                filterModifier = "<>";
                            else if (stringToExcise.Contains(">="))
                                filterModifier = ">=";
                            else if (stringToExcise.Contains("<="))
                                filterModifier = "<=";
                            else if (stringToExcise.Contains(">"))
                                filterModifier = ">";
                            else if (stringToExcise.Contains("<"))
                                filterModifier = "<";
                            else
                                filterModifier = "=";
     
                            assignDate = "(convert(varchar(10), [AssignDate], 101) " + filterModifier + " '" + dateTime.Month.ToString("0#") + "/" + dateTime.Day.ToString("0#") + "/" + dateTime.Year + "')";
     
                            ret = ret.Replace(stringToExcise, assignDate);
                        }
                    }
                }
  19. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Apr 2012 Link to this post

    Right, what user in his right mind wants it to auto-gen a date picker whos results do nothing...
  20. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 12 Apr 2012 Link to this post

    Telerik was quick to point out that it worked as expected and it was not a bug. They were technically correct--however, functionally, a complete miss. Their time drop-down for this scenario just adds insult to injury. I am new to Telerik ASP (came over from the old technology called Silverlight), but for the most part, their ASP stuff is great. It is just in this case they are flat out wrong!
  21. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Apr 2012 Link to this post

    Yeah, sorry that's what I meant :)  It "works"...technically...but generates unusable pointless results that nobody would ever want or expect.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017