GridGroupingControl - Selected records not cleared first time

Dear Syncfusion,

We are using V 4.2.0.37.

gridgroupingControl.Table.SelectedRecords.Clear(); is not clearing the records for the first time. It is only clearing second time. I tried even using gridgroupingControl.Refresh().

What else should we do? Can you plz inform.

Rgds
Rajani kanth

5 Replies

AD Administrator Syncfusion Team September 22, 2006 05:16 AM UTC

Hi Rajani,

I was not able to reprodue this problem here, please see the attached sample that works fine in selected record clear method in the grid.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GGCSelecterRecord_d9ee5cb7.zip

If this did not help, please update us with a sample project showing the problem.

Thanks,
Haneef


BR Badri Rajani Kanth September 25, 2006 08:39 AM UTC

Hi Haneef,

I am not able to download the zip file on your link.

Ok, my form is having a GGC. These are my grid settings

private void FormatGrid()
{
GGC.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None;
GGC.TableOptions.ListBoxSelectionCurrentCellOptions =
Syncfusion.Windows.Forms.Grid.Grouping.GridListBoxSelectionCurrentCellOptions.None;
GGC.TableOptions.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.One;
GGC.TableModel.Options.ShowCurrentCellBorderBehavior =
GridShowCurrentCellBorder.HideAlways;
GGC.TableModel.Options.SelectCellsMouseButtonsMask =
System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right;
GGC.TableControl.HScrollBehavior = GridScrollbarMode.Disabled;
GGC.TableOptions.IndentWidth = 0;
GGC.TableOptions.ShowRowHeader = false;
GGC.TableOptions.CaptionRowHeight = 0;

}

And grid displays few records. When I right click on column headers, i want to clear the record selection. Here is the code for that, which is not clearing for the first time.

private void GGC_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e)
{
int rowIndex = 0;
int colIndex = 0;

bool clickedInsideGrid =
e.TableControl.PointToRowCol(new System.Drawing.Point(e.Inner.X, e.Inner.Y), out rowIndex, out colIndex);
//clicked inside grid?
if(clickedInsideGrid)
{
if(e.Inner.Button == MouseButtons.Right)
{
if(rowIndex == COLUMN_HEADER_ROW_INDEX) //COLUMN_HEADER_ROW_INDEX = 1
{
//clear record selection and contexts
GGC.Table.SelectedRecords.Clear();
return;
}

}
}
}

Rgds
Rajani kanth


AD Administrator Syncfusion Team September 25, 2006 01:02 PM UTC

Hi Rajani,

To get the desired behavior, add the code below in the TableControlMouseDown event handler of the GridGroupingControl.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.PointToTableCellStyle(pt);
if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
{
this.gridGroupingControl1.Table.SelectedRecords.Clear();
}
}

Thanks for using Syncfusion Products.
Regards,
Rajagopal


BR Badri Rajani Kanth September 25, 2006 03:51 PM UTC

Thank You Raja Gopal,

Problem is not with identifying ColumnHeaderCell.

SelectedRecords.Clear() is not clearing the very first time.

Rgds
Rajani kanth


AD Administrator Syncfusion Team September 26, 2006 04:46 AM UTC

Hi Rajani,

We tried to reproduce this issue in 4.1/ 4.2.0.37 with .Net 2003+Windows XP sp2, but could not get this issue. Maybe I am not following the steps that you are doing. Attached sample working fine here. Can you post a small sample showing this problem or tell us how to see it in the Attached sample?

Sample : http://www.syncfusion.com/Support/user/uploads/ClearRecordGGC_317cca61.zip

Please let me know the version number of Studio you are testing this with and the .Net version.

Thanks,
Haneef

Loader.
Up arrow icon