The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
One column of my databound gdbg is a checkbox. This column is a type bit column in the underlying datatable. When the checkbox is clicked, I want to test the value and if true, update a date in another column on the same row. I'm having trouble getting the value of the checkbox. Following is the code for the CheckBoxClick event:
private void gridLabs_CheckBoxClick(object sender, GridCellClickEventArgs e) { //Set complete date if Complete is checked Int32 col1Idx; Int32 col2Idx; gridLabs.CurrentCell.MoveTo(e.RowIndex, e.ColIndex, GridSetCurrentCellOptions.SetFocus); GridCurrentCell cc = gridLabs.CurrentCell; col1Idx = gridLabs.Binder.NameToColIndex("testComplete"); col2Idx = gridLabs.Binder.NameToColIndex("dateTestCompleted"); if (e.ColIndex == col1Idx) { //TestComplete column if (cc.Renderer.ControlText == "False") { //Test is complete gridLabs[e.RowIndex, col2Idx].CellValue = DateTime.Now.ToShortDateString(); } else { //Test is not complete; clear date gridLabs[e.RowIndex, col2Idx].CellValue = DBNull.Value; } }
}
I'm sure there's a simple solution. Your help is greatly appreciated. Thanks in advance.
Sorry. Forgot to point out that in the click event, I always get the checkbox value prior to clicking it. So, if it is unchecked and I check it, the .cellvalue or the .renderer.controltext give me "false" instead of the expected true. Thanks.