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.
I''m trying to create a GGC that has a checkbox, clicking on which will filter the record out of the grid.
I have a table, where a boolean (actually, short integer) column is my criteria, whether the record should be on the grid, or not.
In the following example, I set the filtered dataview as a data source for the grid, however the behaviour is rather strange - I cannot uncheck the checkboxes at all. In debug window I see CancelMouseEvent exception.
Why wouldn''t unchecked records just go away?
Is there a way to do what I want with checkboxes?
(I can probably put a button there, that removes my rows manually inside BeginUpdate/EndUpdate)
---
private void Form1_Load(object sender, System.EventArgs e)
{
DataSet ds = new DataSet("MyDataset");
DataTable dt = ds.Tables.Add("MyTable");
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(short));
DataView dv = new DataView(dt);
dv.RowFilter = "Col2 = 0";
for(int i=0; i<10; i++)
{
dt.Rows.Add(new object [] {"MyText" + Convert.ToString(i), (short)(i % 3)});
}
Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor gtc = gridGroupingControl2.TableDescriptor;
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor gdc = new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor();
gdc.MappingName = "Col1";
gdc.HeaderText = "My Col1";
gdc.ReadOnly = true;
gdc.Appearance.AnyRecordFieldCell.CellType = "Static";
gtc.Columns.Add(gdc);
gdc = new Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor();
gdc.MappingName = "Col2";
gdc.HeaderText = "My Col2";
gdc.ReadOnly = false;
gdc.Appearance.AnyRecordFieldCell.CellType = "CheckBox";
gdc.Appearance.AnyRecordFieldCell.CheckBoxOptions.CheckedValue = "1";
gdc.Appearance.AnyRecordFieldCell.CheckBoxOptions.CheckedValue = "0";
gtc.Columns.Add(gdc);
gridGroupingControl1.DataSource = dt;
gridGroupingControl2.DataSource = dv;
dv.AllowDelete = false;
dv.AllowNew = false;
dv.AllowEdit = true;
}
ADAdministrator Syncfusion Team September 2, 2004 07:07 PM UTC
Does setting
gdc.Appearance.AnyRecordFieldCell.CellValueType = typeof(int);
on the checkbox column make a difference?
ADAdministrator Syncfusion Team September 2, 2004 08:28 PM UTC
Unfortunately, no.
I also tried typeof(short)
Debug window shows:
catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0
ADAdministrator Syncfusion Team September 2, 2004 09:37 PM UTC
I can see the problem in 2.1.0.9 using the code you furnished. It works ok with a GridDataBoundGrid, but fails in the GridGroupingControl. We will look into this to see why it is failing,and update this thread when we have more information.
ADAdministrator Syncfusion Team September 3, 2004 05:11 AM UTC
This problem has been corrected in our library.
If you would like to get a private build with this correction, you can submit a Direct Trac support incident and request one. The next public release scheduled now is a couple of months away.