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

Selection Marker in Row Header

Hi,
I am working on a gridGroupingControl, I have the Row Headers visible for the Grid. I want to show a marker or text '*' in the Row Header of the Row that is currently selected. To restrict the Users to select only certain rows, I handle the TableControlCellClick event and manually Select the Row. In the same event handler I would like to mark the Row as selected by showing a marker in the row header.

Thanks

1 Reply

JJ Jisha Joy Syncfusion Team November 1, 2007 09:29 AM UTC

Hi Arif,

Thank you for posting query to us.

It is possible to show the text in the Row Header of the currently selected rows by handling the events TableControlCellDrawn and TableModel.SelectionChanged of GridGroupingControl.
Here is the code snippets:

void TableModel_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
this.gridGroupingControl1.Refresh();
}

void gridGroupingControl1_TableControlCellDrawn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
GridRangeInfoList list = gridGroupingControl1.TableModel.Selections.Ranges;
foreach (GridRangeInfo range in list)
{
if (e.Inner.RowIndex >= range.Top && e.Inner.RowIndex <= range.Bottom)
{
if (e.Inner.ColIndex == 0)
{
e.Inner.Graphics.DrawString("*", new Font("Aerial", 10), Brushes.Red, e.Inner.Bounds.Location);
e.Inner.Cancel = true;
}

}
}
}


Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69490/main.htm

Please try this and let me know if this helps.

Regards,
Jisha




Loader.
Live Chat Icon For mobile
Up arrow icon