Ticket Q360794
Visible to All Users

DateTime format in grid column

created 13 years ago

I just want to display both date and time in a column, not just the date. The problems is the same as this: http://www.devexpress.com/Support/Center/p/Q141539.aspx but I'm using WinForms not aspx. So I don't have PropertiesDateEdit, and DisplayFormat is read only. What syntax should I use?
Logically it should be:
 view.Columns[Tables.Maintenance.Time.Title].Properties.DisplayFormat = "g";
but this doesn't work, there is no 'Properties' property.

Answers

created 13 years ago (modified 7 years ago)

Hi Christopher,
Thank you for your question.
To accomplish this task, set the GridColumn.DisplayFormat.FormatType property to the FormatType.DateTime value and use the following format string: "g". I suggest you refer to the Formatting Cell Values topic for more details. I have created a sample project to demonstrate this approach in action. Please let us know whether or not this solution meets your requirements. If not, feel free to reactivate this ticket.
Thank you,
Pavel.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.