AD
Administrator
Syncfusion Team
August 16, 2006 05:14 PM UTC
If you want this behavior (selecting rows) for all your tables, then you can set these properties.
this.grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.grid.TableOptions.ListBoxSelectionCurrentCellOptions = GridListBoxSelectionCurrentCellOptions.None;
But if you only want this behavior on a single table, then you can handle an event instead of setting the ListBoxSelectionMode (You still have to set the istBoxSelectionCurrentCellOptions to none).
void hierarchyGrid_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
if (e.TableControl.Table.TableDescriptor.Name == "ChildTable")//name of your child table
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.GetViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex) as GridTableCellStyleInfo;
GridRecord r = style.TableCellIdentity.DisplayElement.GetRecord() as GridRecord;
if (r != null)
{
e.TableControl.Table.SelectedRecords.Clear();
r.SetSelected(true);
}
}
}