How to save cell changes to the data base of DateTimePicker in WinForms GridControl?
Save the changes to the database
In order to save the changes in database for datetimepicker cell type, GridControl has support to save the cell values using SaveCellInfo event. Using e.ModifyType you can check the status of the cell value like whether it is modified or newly added.
//MonthCalendar celltype
this.gridControl1[1, 2].Text = "MonthCalendar";
this.gridControl1.ColWidths[2] = 100;
this.gridControl1[2, 2].CellType = GridCellTypeName.MonthCalendar;
//Event Handler
this.gridControl1.SaveCellInfo += this.gridControl1_SaveCellInfo;
void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
{
//Saves the modified value in a temp variable.
string temp = e.Style.CellValue.ToString();
}
'MonthCalendar celltype
Me.gridControl1(1, 2).Text = "MonthCalendar"
Me.gridControl1.ColWidths(2) = 100
Me.gridControl1(2, 2).CellType = GridCellTypeName.MonthCalendar
'Event Handler
AddHandler Me.gridControl1.SaveCellInfo, AddressOf Me.gridControl1_SaveCellInfo
Private Sub gridControl1_SaveCellInfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs)
'Saves the modified value in a temp variable.
Dim temp As String = e.Style.CellValue.ToString()
End Sub
The
screenshot below displays the DatePicker control inside the Grid
Conclusion
I hope you enjoyed learning about how to save changes of the cell to the data base of DateTimePicker in WinForms GridControl.
You can refer to WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridControl example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!