We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Datagrid bool column drag-drop problem

Firstly, thanks for an extrememly useful site! I have a datagrid with a column of checkboxes bound to a boolean field in my dataset using a DataGridBoolColumn. All is well except when the user drags one checkbox onto another (this occurs by accident when rapidly clicking the checkboxes). In this case the error dialog "Error when committing the row to the original datastore. The list managers position must be equal to rowNum. Parameter name:rowNum. Do you want to correct the value?" appears. Could anyone tell me how to disable this drag-drop or otherwise avoid this problem. Many thanks, Chris

6 Replies

AD Administrator Syncfusion Team January 29, 2003 02:05 AM UTC

Hi Chris, I am looking for a solution..i have just started on my development, hence i believe you will have knowledge on this: - After adding checkboxes into my datagrid, it appeared checked. i could not retrieve the checkbox's value or assign any value (true or false)no matter the check in which state.. and i have to click twice before i can check or uncheck. Please help.


BS Bryan Sherlock February 1, 2003 11:20 PM UTC

How did you fix the “The list managers position must be equal to rowNum.” Error? Thanks, Bryan


AD Administrator Syncfusion Team March 19, 2003 01:00 PM UTC

I'm dealing with the same problem. The data source for my DataGrid is a database view that includes a couple of bit columns. The view has "instead of insert" and "instead of update" triggers. The bit columns are loaded as DataGridBoolColumns in the DataGrid. When I click the checkboxes nothing happens. However, if I press spacebar when the checkbox has focus, the checkbox state changes. I can then move to a cell (not a check box) on another row and the state of the checkbox is saved to the view. Every now and then I get a error message that says: "The list managers position must be equal to rowNum." I haven't figured why I can't change the state of the checkbox by clicking it and I have no idea why I get the error message. And ideas?


IG Ivan Gamanyuk March 21, 2003 06:47 PM UTC

Hi, I haven't tested the following code thoroughly, but it appears to be working. Any efficiency suggestions would be greatly appreciated. private void dataGridAds_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { DataGrid dg = (DataGrid)sender; CurrencyManager cm = (CurrencyManager)this.BindingContext[dg.DataSource,dg.DataMember]; DataGrid.HitTestInfo hti = dg.HitTest(e.X, e.Y); try { if( hti.Type == DataGrid.HitTestType.Cell && (dataGridAds.TableStyles[0].GridColumnStyles[hti.Column].GetType()== typeof(System.Windows.Forms.DataGridBoolColumn))) { DataRow dr = ((DataTable)dg.DataSource).Rows[hti.Row]; DataGridColumnStyle dgc = dataGridAds.TableStyles[0].GridColumnStyles[hti.Column]; if(dg.BeginEdit(dgc, hti.Row)) { dr.BeginEdit (); if (dg[hti.Row, hti.Column].Equals(System.DBNull.Value)) { dg[hti.Row, hti.Column]=false; } else { dg[hti.Row, hti.Column] = ! (bool) dg[hti.Row, hti.Column]; } dr.EndEdit(); dg.EndEdit(dgc, hti.Row, true); } else { // Next will kill the focus of the current cell //dg.EndEdit(dgc, hti.Row, true); cm.EndCurrentEdit(); } } } catch(Exception ex) { MessageBox.Show(ex.ToString()); } }


VD Vishal Dattani June 5, 2003 09:01 AM UTC

While Creating the table style for ur datagrid. when u have a datagridboolcolumn, make its 'allownull' property to false. this will make ur boolean column have only two values viz. true/false. [note: by default the boolean column has three values viz. true/false/null and this causes problems while clicking with mouse also.] Eg: Dim TextCol = New DataGridBoolColumn() TextCol.MappingName = "ChkBox" TextCol.HeaderText = "Check" TextCol.AllowNull = False hope that helps. Vishal > Firstly, thanks for an extrememly useful site! > > I have a datagrid with a column of checkboxes bound to a boolean field in my dataset using a DataGridBoolColumn. > > All is well except when the user drags one checkbox onto another (this occurs by accident when rapidly clicking the checkboxes). In this case the error dialog "Error when committing the row to the original datastore. The list managers position must be equal to rowNum. Parameter name:rowNum. Do you want to correct the value?" appears. > > Could anyone tell me how to disable this drag-drop or otherwise avoid this problem. > > Many thanks, > Chris > >


JO john.coleman October 27, 2003 06:57 PM UTC

This works like a charm. I found that you may want to add a datagrid.Refresh() after the mouse click, b/c mine was not painting the checkbox change. Microsoft has little work to do with this control...

Loader.
Live Chat Icon For mobile
Up arrow icon