I want to display the data and time in the following in format in a grid cell:
yyyy-MM-dd
hh:mm
But I don't know how to add the enter between the date and the time. I tried to /n, but it didn't work.
Thanks.
Set the CellMultiLine property to true. In run time assign string value with format that includes /n.
venpisi said: Set the CellMultiLine property to true. In run time assign string value with format that includes /n.
Thanks, venpisi, but this is not what I want. Since the input value is of DateTime type, I can use the Format property of the column to set how the text is actually displayed.
For example:
I can set the Format property to "yyyy-MM-dd hh:mm" to display the DateTime as 2008-11-7 12:00 or I can set it to "hh:mm" to display the DateTime as "12:00"
My current problem is I want to insert something to represent an Enter between the Date and the Time. I guessed it is "\n", but it is not. In this case I don't have to loop all rows in the grid to set their format.
Do you need the column to be editable and have a date dropdown? If so, then I don't think this can be done. The DateTime editor in the grid does not support multi-line text.
If you don't need editing and just want to display the date, then you can do something like this:
rootBand.Columns["DateTime 1"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Edit; rootBand.Columns["DateTime 1"].CellActivation = Activation.NoEdit; rootBand.Columns["DateTime 1"].CellMultiLine = DefaultableBoolean.True; rootBand.Columns["DateTime 1"].Format = "yyyy-MM-dd\nhh:mm";