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
235
Cannot format "Time" column in UltraWinGrid
posted

I have several places where I am selecting columns from SQL and loading them into a grid which are datatype "Time(0)" in SQL. I have attempted to format them using the following:

e.Layout.Bands(0).Columns("TimeIn").Format = "hh:mm:ss tt"

But to no avail. This works fine if I cast the columns in SQL as DateTime, but otherwise does not. Is there a different format string for Time datatypes? 

Parents
  • 23930
    Offline posted

    Hi Nick,

    Thank you for posting in our forums.

    It doesn’t really matter what the type of the field is in your database. What actually matters is what the type of the field is in the grid’s data source. If it is of type DateTime the code that you are using will work. If it is of type string this code won’t work since setting a format of a string doesn’t do anything. If this is the case set the column’s Style to Time:

                e.Layout.Bands(0).Columns("TimeIn").Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Time

    Please let me know if you have any additional questions.

Reply Children