Flex datetime column

Posted by: moshek on 26 July 2018, 9:30 am EST

    • Post Options:
    • Link

    Posted 26 July 2018, 9:30 am EST

    How can I force DateTime column to edit by simple TextBox and not by DatePicker ??

  • Posted 27 July 2018, 2:27 am EST

    Hi,

    To force the DateTime column to be edited by simple TextBox, you can capture the “StartEdit” event of the grid and check whether the data type of the column is DateTime. If yes, set the “C1FlexGrid.Editor” property to the TextBox control.

    
    if (_grid[e.Row, e.Col].GetType() == typeof(DateTime))
                {
                    _grid.Editor = _textBox;
                }
    
    
    

    For reference please see the attached sample. Try editing the cells of the columns with names “BirthDate” and “HireDate”.

    Please let us know if you need any other help.

    Thanks.

    DateTimeTextBox.zip

  • Posted 29 July 2018, 5:55 am EST

    Very ugly.

    I need that HireDate will work like Address.20180729_124433.zip

  • Posted 30 July 2018, 5:56 am EST

    Hi Moshe!

    In order to deal with DateTime type values in the grid cells, without showing DateTimePicker, you can take advantage of EditMask and Format properties of C1FlexGrid column.

    //For HireDate column :
    _grid.Cols[7].DataType = typeof(object);
    _grid.Cols[7].Format = "d";
    _grid.Cols[7].EditMask = "00-00-0000";
    

    In case you want more control over what the user is typing in this column, please use SetUpEditor event of the grid.

    http://help.grapecity.com/componentone/NetHelp/c1flexgrid/webframe.html#C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.C1FlexGridBase~SetupEditor_EV.html

    Regards,

    Meenakshi

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels