How to get the value of a Date field in row of sfdatagrid?

How to I read the value of a datetimepicker in datarow?  when I try it always shows "01/01/001  00:00:00", when the actual date is 9/2/2024?


1 Reply

MS Malini Selvarasu Syncfusion Team October 3, 2024 01:45 PM UTC

Hi Kevin Davis,

Thank you for reaching out. We have reviewed your scenario; however, we would like to clarify your requirements further. You mentioned that it always shows "01/01/0001 00:00:00" when the actual date is 9/2/2024. Could you please specify whether you are trying to read the actual value or the value from editor? This information will help us gain a clearer understanding of the issue and work towards a prompt solution.
If you are attempting to retrieve the actual value of the `DateTimeColumn`, you can do so using the `sfDataGrid1.CurrentCellActivated` event, which allows you to access the value of the cell. Please refer to the code snippet below for guidance.
Code Snippet:
private void SfDataGrid1_CurrentCellActivated(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellActivatedEventArgs e)
{
     MessageBox.Show(("Date : " + (e.DataRow.RowData as OrderInfo).Date.ToString("MM/dd/yyyy")));
}
Regards,
Malini Selvarasu

Loader.
Up arrow icon