BoldDeskPremium customer service software with affordable pricing: $10 for 3 agents. Try it for free.
private void gridDataBoundGrid2_CurrentCellValidating(object sender, CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid2.CurrentCell; if(cc.ColIndex == 7) { string newValue = cc.Renderer.ControlText; try { double d = double.Parse(newValue); } catch { cc.ErrorMessage = "Not a double..."; e.Cancel = true; } } }In a GridDataBoundGrid, changes are cached on a row by row basis, and are only pushed to the datasource when the user leaves the row. There are events asociated with these actions as well, RowLeave, RowSaved, RowEditing and RowEnter. For a GroupingGridControl, the CurrentRecordContextChange event is raised at several points during the current cell activating editing process. You can check e.Action in this event to get the context. You also have access to the TableControlCurrentCellChanged and TableControlCurrentCellValidating events (like GridDataBoundGrid). Here is a forum thread with some info on this event. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=22307 5) In a GridDataBoundGrid, you can use the grid.Binder.BindingListChanged to get at the ListChanged event on the datasource. You can check the ListChangeType to see that different actions that are caught by this event. Normally, ILists only raised a ListChanged event which is after the action and not prior to the action. SO, I do not know of a good way to get the actions handled in ListChanged before thay actually take place in the DataSource in general. If youwant to catch actions from changes within the grid itself (not actions done by some other datasource user outside the grid), you can use the row events mentioned above. In a GridGroupingControl, there are SourceListRecordChanging and SourceListRecordChanged events. You can check the e.Action to see what action is taking place. Here is a little sample showing these vents. http://www.syncfusion.com/Support/user/uploads/GGC_ChangeEvents_727fbb1.zip 6) The TableControlCurrentCellChanged event in GridGroupingControl and the CurrentCellChanged event in GridDataBoundGrid should be raised with a change to a combobox cell.
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("boolCol");
this.gridGroupingControl1.TableDescriptor.Columns["boolCol"].Appearance.AnyRecordFieldCell.BackColor = Color.Red;
this.gridGroupingControl1.QueryValue += new FieldValueEventHandler(gridGroupingControl1_QueryValue);
To specify the column''s cell type like a combobox or checkbox, you would set the CellType property on the appearance object.
this.gridGroupingControl1.TableDescriptor.Columns["Col"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";
this.gridGroupingControl1.TableDescriptor.Columns["Col"].Appearance.AnyRecordFieldCell.DataSource = someDataTable;
this.gridGroupingControl1.TableDescriptor.Columns["Col"].Appearance.AnyRecordFieldCell.DisplayMember = "someCol";
this.gridGroupingControl1.TableDescriptor.Columns["Col"].Appearance.AnyRecordFieldCell.ValueMember = "someCol";
3) You set TableDescriptor.Columns["Col"].Appearance.Format. To have the format be applied properly, you also have to make sure TableDescriptor.Columns["Col"].Appearance.AnyRecordFieldCell.CellvalueType is set properly, otherwise teh format is ignored.
4) You can set these properties on this.gridGroupingControl1.TableDescriptor.Columns["someCol"].