Articles in this section
Category / Section

How to save changes of the cell to the data base of DateTimePicker in WinForms GridControl?

1 min read

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.

C#

//MonthCalendar celltype
this.gridControl1[1, 2].Text = "MonthCalendar";
this.gridControl1.ColWidths[2] = 100;
this.gridControl1[2, 2].CellType = GridCellTypeName.MonthCalendar;
//Event Handler
Me.gridControl1.SaveCellInfo += gridControl1_SaveCellInfo
 
void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
    {
       //Saves the modified value in a temp variable.
       string temp = e.Style.CellValue.ToString();
     }

 

VB

'MonthCalendar celltype
 Me.gridControl1(1, 2).Text = "MonthCalendar"
 Me.gridControl1.ColWidths(2) = 100
 Me.gridControl1(2, 2).CellType = GridCellTypeName.MonthCalendar
'Event Handler
 Me.gridControl1.SaveCellInfo += 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

 

Screenshot

Save changes of the cell to the database

 

 

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 our WinForms Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Grid 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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied