Force a row select

In relation to the following KB article
http://www.syncfusion.com/Support/forums/message.aspx?&MessageID=63639

If I have an unbound checkbox column, the user clicks a check box in a row which is not the CURRENT row and in the GGC_TableControlCheckBoxClick event I want to create a record object for the appropriate row before forcing a RaiseSaveValue to reflect the check box selection e.g.
Record rec=e.TableControl.Table.CurrentRecord;
FieldValueEventArgs fArg=new FieldValueEventArgs(e.TableControl.TableDescriptor.Fields["Resubmit"], rec, false); e.TableControl.TableDescriptor.RaiseSaveValue(fArg);

The problem here is that e.TableControl.Table.CurrentRecord gives the SELECTED grid row (if there even is one), not the row for the selected check box. How do I force the current row to be the one for the selected checkbox.

To be honest if anyone has a better approach for IMMEDIATELY reflecting check box column changes in the grid (i.e. when it is clicked, not later when the cell has lost focus) I would love to see it. I am loathe to implement the forcing of event handlers in code.

1 Reply

RA Rajagopal Syncfusion Team July 18, 2007 07:30 PM UTC

Hi Paul,

You could get the record object of the clicked checkbox in the TableControlCheckBoxClick event by using the following code snippets.

private void gridGroupingControl1_TableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e)
{
Record rec = e.TableControl.Table.DisplayElements[e.Inner.RowIndex].ParentRecord;
FieldValueEventArgs fArg=new FieldValueEventArgs(e.TableControl.TableDescriptor.Fields["Resubmit"], rec, false); e.TableControl.TableDescriptor.RaiseSaveValue(fArg);
}

Have a nice time.
Regards,
Rajagopal

Loader.
Up arrow icon