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.
Unfortunately, activation email could not send to your email. Please try again.

Clearing the selection in GridGroupingControl.

Thread ID:

Created:

Updated:

Platform:

Replies:

58645 Mar 26,2007 03:58 AM Apr 5,2007 03:57 PM Windows Forms 6
loading
Tags: Grouping
Manjula Boudannavar
Asked On March 26, 2007 03:58 AM

Hi,

I have GridGroupingControl version 4.2.0.60 in a .NET windows application. I am highlighting the whole record programmatically.Below is the code snippet to achieve this selection.

grid_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) {
e.Inner.Style.Interior = highlightRowBrush;
e.Inner.Style.TextColor = SystemColors.HighlightText;

The grid is grouped on some column.I click on the cell(say c1), the whole record containing that cell is highlighted . Now click on the group header and click on the other cell(say c2). Now the previously selected record(record of cell c1) will still be highlighting and also the currently selected(record of cell c2). Grid looks like having multiple selections. Please let me know the properties I need to set to clear the previous selection.

Regards,
Manjula.

Jeba S [Syncfusion]
Replied On March 27, 2007 01:45 AM

Hi Manjula,

Please try this code snippet to highlight the whole record and to avoid the previous selection.

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
// Highlight the current row with SystemColors.Highlight and bold font
if (e.Inner.RowIndex > 3 && e.Inner.ColIndex > 0 && cc.HasCurrentCellAt(e.Inner.RowIndex))
{
e.Inner.Style.Interior = new BrushInfo(SystemColors.Highlight);
e.Inner.Style.TextColor = SystemColors.HighlightText;
e.Inner.Style.Font.Bold = true;
}
}


Kindly let us know if this helps.

Best Regards,
Jeba.

Manjula Boudannavar
Replied On March 27, 2007 06:03 AM

Hi,

Thanks for your response. Its working. I am highlighting the row with the blue colour and it also highlights the cell with the blue colour which I dont want. The cell I click on should have the background colour white(The selection should not highlight the cell) Please see the attached snapshot.

Please let me know which properties I need to set or any other approach would do.

Regards,
Manjula.

SnapShot2.zip

Jeba S [Syncfusion]
Replied On March 28, 2007 12:04 AM

Hi Manjula,

Please try this code snippet to highlight the row and the current cell with white background.

gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One
gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None
gridGroupingControl1.TableOptions.SelectionBackColor = Color.Pink
gridGroupingControl1.TableOptions.SelectionTextColor = Color.SteelBlue
gridGroupingControl1.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor


Kindly let us know if this helps.

Best Regards,
Jeba.

Manjula Boudannavar
Replied On March 28, 2007 07:04 AM

Hi,

I want to have the event grid_TableControlPrepareViewStyleInfo and highlight the row programmatically not by setting any properties. But the cell I click on should have white background as explained before.

Please let me know what code or any proeprties I need to set to have that behaviour.

Thanks and Regards,
Manjula.

Manjula Boudannavar
Replied On April 5, 2007 05:22 AM

Hi,
Do you have any suggestion. Please let me know.

Regards,
Manjula.

haneefm [Syncfusion]
Replied On April 5, 2007 03:57 PM

Hi Manjula,

Please try this code.

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if( style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record )
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if( cc.RowIndex == e.Inner.RowIndex
&& cc.ColIndex == e.Inner.ColIndex)
{
e.Inner.Style.BackColor = Color.White;
e.Inner.Style.TextColor = Color.White;
}
}
}

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;