Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello,


                                    Here is my scenario. I have an XtraGrid. Inside I have a main view and a details view. In the details view I have a column that displays a DateTime value. What I would like to achieve is to display only the time portion of the value. I am binding the column at run time when the user expands the details of the master row.


                                    I tried setting up the FormatType to "DateTime" and the FormatString to "t", but that did not affect the display. I also tried to set the type to "Custom" and the String to "hh:mm tt", but this did not work either. I did this using the designer. I played around with different combinations just to see if they have any effect on the display, but the displayed value always stayed displayed as "May 20 2012 12:00PM".


                                    What am I missing? This seems pretty straight forward and I am at loss what could I be possibly doing wrong. I have read through the documentation and I did not find anything different from what I am already doing.


                                    Thank you.

                                • Crono 06.16.2012

                                  Well custom doesn't exactly work that way (you must use brackets), but your first attempt using Datetime and "t" should have done the job... are you doing any custom painting or using the CustomColumnDisplayText event? Do you have a dedicated editor that itself isn't formatted properly?

                                • DanielDragnev 06.16.2012

                                  No, I do not do any custom painting. I am using a standard TimeEdit as a editor. The edit mask of the editor is set to "t" and it works well.

                                • DanielDragnev 06.16.2012

                                  I worked around the problem by handling the CustomColumnDisplayText event :

                                         If e.Column.FieldName = "[column_name]" Then
                                              Dim d As DateTime
                                              If DateTime.TryParse(e.DisplayText, d) Then
                                                  e.DisplayText = d.ToString("hh:mm tt")
                                              Else
                                                  e.DisplayText = ""
                                              End If
                                          End If
                                  but it seems that there should be an easier wey.

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Your mask must work. It is necessary to set this mask to a column that displays a time value for a detail pattern view. Please refer to the Pattern and Clone Views help topic to see how to obtain a pattern view.

                                If you don't manage to resolve the issue, send us a small project to illustrate how you provide data and views for the Grid.

                                You must  log in  or  register  to leave comments
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Your Privacy - Legal Statements

                                Copyright © 1998-2013 Developer Express Inc.
                                ALL RIGHTS RESERVED
                                All trademarks or registered trademarks
                                are property of their respective owners