Active Cell and CellClick Event

I''m having an active cell issue when a GDBG has a controls other then a Textbox. I have a CellClick event handler so I can perform validation before fields can be edited. In the event handler I am doing the following:

GridDataBoundGrid grid = (GridDataBoundGrid) sender;
GridModelDataBinder binder = grid.Binder;
GridCurrentCell cc = grid.CurrentCell;
int colIndex = grid.CurrentCell.ColIndex;
int rowIndex = grid.CurrentCell.RowIndex;
int field = binder.ColIndexToField(colIndex);
GridBoundColumn column = binder.InternalColumns[field];
string colName = column.MappingName;

It appears the MonthCalendar CellType does not become active (The cell I was last on is returned), when the eventhandler fires, unless I select the cell by tabbing to it first. A checkbox celltype has the same issue.

1 Reply

AD Administrator Syncfusion Team September 5, 2006 05:59 AM UTC

Hi JMS,

If you set the property ActivateCurrentCellBehavior to ClickOnCell then the cell gets activated after clicking on it. If you click the dropdown button of the cell ( like ComboBox button , MonthCalender button , push button ,etc), it doesn''t activate the cell in a grid. To activate the current cell in checkbox click/cellclick event , you need to use the CurrentCell.MoveTo method.

this.grid.CurrentCell.MoveTo(e.Inner.RowIndex,e.Inner.ColIndex,GridSetCurrentCellOptions.SetFocus);

If you want to validate the cell in a gird, you can handle the validating event. Please refer the below link for more details.

KB Link : http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Regards,
Haneef

Loader.
Up arrow icon