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

Checking if a column in a GGC has a Checked ComboBox or a normal ComboBox

Hi, I have a GGC Grid which has a column that has a normal ComboBox and another column that has a CheckedList ComboBox. somewhere along my code i need to get only the column that has the checked ComboBox. A couple of days ago you suggested i use the typeof (e.TableControl.CurrentCell.Renderer) to check if a combobox is checked or normal. The code below shows how i try to achieve this. The if() statement inside the foreach() loop is suppose to check whether a column has a ComboBox and whether that ComboBox is a Checked ComboBox. private void GGC_TableControlKeyDown(object sender, GridTableControlKeyEventArgs e) { if(e.Inner.KeyCode == Keys.Delete) { Syncfusion.Grouping.Record rec = e.TableControl.Table.CurrentRecord; if(rec != null) { int i = e.TableControl.Table.FilteredRecords.IndexOf(rec); if(i > 0) { e.TableControl.Table.CurrentRecord = e.TableControl.Table.FilteredRecords[i-1]; e.TableControl.Table.CurrentRecord.SetSelected(true); } int c=0; foreach(GridColumnDescriptor col in e.TableControl.Table.TableDescriptor.Columns) { c++; if(col.Appearance.AnyRecordFieldCell.CellType == "ComboBox") { this.descriptor = (ClientColumnIndirectLookUp) this.dataSheetControl.TableControl.Model [i, c].DataSource; DataRow current_row = (DataRow)rec.GetData(); int id = Convert.ToInt32( current_row[ this.descriptor.Class.Layer.PrimaryField.Name ]); descriptor.DeleteListFromRelation(id); rec.Delete(); e.Inner.Handled = true; break; } } } } Regards David

4 Replies

AD Administrator Syncfusion Team July 8, 2005 08:07 AM UTC

You did not say what happens when you step through the code? I assume that if(col.Appearance.AnyRecordFieldCell.CellType == "ComboBox") is never true. Is that correct? What do you see when you do a quickwatch on col.Appearance.AnyRecordFieldCell.CellType as you go through the loop? Instead of that check, try if(col.Appearance.RecordFieldCell.CellType == "ComboBox" || col.Appearance.AlternateRecordFieldCell.CellType == "ComboBox") to see if that makes a difference.


AD Administrator Syncfusion Team July 8, 2005 08:19 AM UTC

>You did not say what happens when you step through the code? I assume that > >if(col.Appearance.AnyRecordFieldCell.CellType == "ComboBox") > >is never true. Is that correct? What do you see when you do a quickwatch on col.Appearance.AnyRecordFieldCell.CellType as you go through the loop? > >Instead of that check, try > >if(col.Appearance.RecordFieldCell.CellType == "ComboBox" || col.Appearance.AlternateRecordFieldCell.CellType == "ComboBox") > >to see if that makes a difference. Hi, The check does work. However, what i want is that it should not enter inside of the if() statement if a column contains a normal ComboBox. It should only enter inside of the if() statement if a Column has a CheckedListBox i.e. a ComboBox that allows checking and unchecking of values/items.


AD Administrator Syncfusion Team July 8, 2005 08:29 AM UTC

I assume your special checklist cell does not have the celltype = "ComboBox". Is this true? If you want to pickout your checklist cell, then what is its CellType? We do not ship a checklist cell in our library (that I can think of now). So, I think you must have added it, and you would have specfied the value of CellType through the string you passed in CellModels.Add. It is this string you would search for. In your watch window, what is the value you see for col.Appearance.RecordFieldCell.CellType when you hit your checklist column?


AD Administrator Syncfusion Team July 8, 2005 09:04 AM UTC

>I assume your special checklist cell does not have the celltype = "ComboBox". Is this true? > >If you want to pickout your checklist cell, then what is its CellType? We do not ship a checklist cell in our library (that I can think of now). So, I think you must have added it, and you would have specfied the value of CellType through the string you passed in CellModels.Add. It is this string you would search for. > >In your watch window, what is the value you see for col.Appearance.RecordFieldCell.CellType when you hit your checklist column? Thanks a lot, it seems to be working fine now. The problem was actually with the type of cell type i added in the CellModels.Add statement.

Loader.
Live Chat Icon For mobile
Up arrow icon