Home Forums WinForms controls Xceed Grid for WinForms Cannot insert into datetime column

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14440 |

    Hello,

    I am trying to display and edit columns in a sqlserver2005 datetime column using an xceed grid. I am trying to display only the time out of the table’s data. I have followed the post referenced at:

    http://www.xceedsoft.com/Forums/ShowPost.aspx?PostID=3984

    However, when I implement this code, the time columns will not display data, nor will they allow updating or adding time data. When I take the formatprovider and formatspecifier code out and just use the date picker in the grid, I can edit, and edit the columns. Does anyone have any ideas for this?

    Thanks in Advance,

    Brandon

    Imported from legacy forums. Posted by bolson (had 4001 views)

    User (Old forums)
    Member
    Post count: 23064

    It is likely that you are using a WinDatePicker/DateEditor on the column, but this doesn’t support the display of time in the dropdown. Set a TextEditor as the CellEditorManager on the column, and then the FormatProvider and FormatSpecifier should work.

    Imported from legacy forums. Posted by André (had 646 views)

    User (Old forums)
    Member
    Post count: 23064

    AndreC,

    Thanks so much for your reply! I changed the CellEditorManager and CellEditorViewer to TextEditor and TextViewer, respectively. That solved my display problem, however, the data is still read-only. Is there a property of the cell that I should set or something? I know this has to be something little that I am missing.

    Thanks Again for your help,

    Brandon Olson

    Imported from legacy forums. Posted by bolson (had 385 views)

    User (Old forums)
    Member
    Post count: 23064

    Verify that the column ReadOnly property is set to false. Else, make sure the field from the data source is editable.

    Imported from legacy forums. Posted by André (had 490 views)

    User (Old forums)
    Member
    Post count: 23064

    AndreC,

    Thanks again for your help. I still cannot get this to work correctly. If I just use the calendar dropdown in the grid, I can edit the columns just fine. However, when I start changing the formatspecifier and formatprovider, the cell an no longer be edited. I have even tried setting the readonly property to false. Here is a code snippet of what I am doing.

    Dim format As New System.Globalization.DateTimeFormatInfo()
    starterGrid.Columns(“openHouse_startTime”).FormatSpecifier = “t”
    starterGrid.Columns(“openHouse_startTime”).FormatProvider = format
    starterGrid.Columns(“openHouse_startTime”).ReadOnly = False

    What am I missing? I know it has got to be something pretty small, but it is frustrating nonetheless.

    Thanks Again,

    Brandon

    Imported from legacy forums. Posted by bolson (had 338 views)

    User (Old forums)
    Member
    Post count: 23064

    The problem is the FormatSpecifier property. This is not a valid format. Normally, you have to set time to something like this “HH:mm” or “hh:mm tt”…

    Imported from legacy forums. Posted by André (had 5076 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.