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

    Hi,

    In Rich Cell Editor, there is a control called “date editor” which selects only date but as per my requirement i need to select date and time how to achieve it.

    Please advise me on this.  Thanks in advance.

    Imported from legacy forums. Posted by pravi (had 818 views)

    Xceed Support
    Member
    Post count: 5658

    Our WinDatePicker does not support Time. Here, I would suggest to use the MS DateTimePicker as a CellEditorManager (and an other one as a CellViewerManager).

    Here is a code example:

    DateTimePicker dtpEditor = new DateTimePicker();
    dtpEditor.Format = DateTimePickerFormat.Custom;
    dtpEditor.CustomFormat = “yyyy-MM-dd hh:mm:ss”;

    DateTimePicker dtpViewer = new DateTimePicker();
    dtpViewer.Format = DateTimePickerFormat.Custom;
    dtpViewer.CustomFormat = “yyyy-MM-dd hh:mm:ss”;

    gridControl1.Columns[ 2 ].CellEditorManager = new CellEditorManager( dtpEditor, “Value”, true, true );
    gridControl1.Columns[ 2 ].CellViewerManager = new CellViewerManager( dtpViewer, “Value” );

    Imported from legacy forums. Posted by CharlesB (had 639 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the reply.

    But, if we didn’t give any default value for that cell it is not functioning properly.

    And when i give datetime.now value as default value for the cell it is functioning , but when we select another date, just date is updating but no time is updating.

    Thanks
    Praveen Kumar

     

    Imported from legacy forums. Posted by pravi (had 420 views)

    Xceed Support
    Member
    Post count: 5658

    I think this is a normal behavior. You can change the time in the text area. I wouldn’t have assumed that picking a new date would have set the time to 12:00:00. However, by handling the ValueChanged event, you could implement this.

    Imported from legacy forums. Posted by CharlesB (had 520 views)

    User (Old forums)
    Member
    Post count: 23064

    As your previous response,  I have been implemented the following

    Dim dataRow As DataRow

    dataRow = xgc_masterSplReq.DataRows.AddNew()

    Dim dtpEditor As New DateTimePicker

    dtpEditor.Format = DateTimePickerFormat.Custom

    dtpEditor.CustomFormat =

    “MM/dd/yy hh:mm:ss”

    Dim dtpViewer As New DateTimePicker

    dtpViewer.Format = DateTimePickerFormat.Custom

    dtpViewer.CustomFormat =

    “MM/dd/yy hh:mm:ss”

    Dim dateEditor As New DateEditor()

    dataRow.Cells(

    “Value”).CellEditorManager = New CellEditorManager(dtpEditor, “Value”, True, True)

    dataRow.Cells(

    “Value”).CellViewerManager = New CellViewerManager(dtpViewer, “Value”)

    dataRow.Cells(

    “Value”).Value = DateTime.Now

    dataRow.EndEdit()

    This is working fine But when we didn’t give any default value (i.e. commented the “dataRow.Cells(“Value”).Value = DateTime.Now” code)

    It is giving crossmark for the cell and not allowing me to edit. How can I show as empty and allow the user to select the date and time.

    Please advise me on this.  Thanks in advance.

     

    Imported from legacy forums. Posted by pravi (had 1533 views)

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