Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
444
How to specify the grid to display both date and time instead of just date?
posted

I add columns and rows in the grid RUNTIME. Even if my column is of type DateTime and the value has both date and time, the grid displays only date, not time. I understand that there is a property to set that. I tried doing something like

grid1.DisplayLayout.Bands(0).Columns("Col1").Format = "mm/dd/yy hh:mm:ss"  

But the steps I follow to add data to grid are are like

- Add data(rows and Columns) to a data table (m_pDataTable) at runtime from the database

- grid1.DataSource = m_pDataTable

- Set the format for required column 

It works fine. But looks like its messing up the date that is to be displayed. From database to a dataRow the value when added is
" #11/27/2007 11:05:34 AM# "
 
And then I the steps I did was
 
m_pDataTable.Rows.Add(m_pDataRow)
grid1.DataSource = m_pDataTable
grid1.DisplayLayout.Bands(0).Columns("Col1").Format = "mm/dd/yy hh:mm:ss"
grid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False
End Sub
 
And now I see the value displayed at output as '  05/27/07 11:05:34 '.
In simple terms, before the piece of code I wrote the m_pDatRow("Col1") = #11/27/2007 11:05:34 AM#
and after the code the value is  05/27/07 11:05:34
I couldn't understand why this is happening 

Thanks in advance,                                                                                                                                                                                Sindhu

Parents Reply Children
No Data