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

Reg: Grid Grouping Control

Hi, In my grouping grid i am using check box. In grid ,if i click and drag corresponding rows checkbox should get checked. How do i do that...? Thanks, Anna

7 Replies

AD Administrator Syncfusion Team July 22, 2005 02:01 PM UTC

If you are using the RecordSelection functionality specific to the GridGroupingControl (ListBoxSelectionMode set something beside None and AllowSelection set to None), then you can use this event to catch the record selection changed.
private void gridGroupingControl1_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{
	if(e.Action == SelectedRecordsChangedType.Added)
	{
		e.SelectedRecord.Record.SetValue("boolCol", true);
	}
	else if(e.SelectedRecord != null)
	{
		e.SelectedRecord.Record.SetValue("boolCol", false);
	}
}


AS Anna Srinivasan July 22, 2005 02:39 PM UTC

Hi, Can you please upload the sample...! Thanks, Anna


AD Administrator Syncfusion Team July 22, 2005 04:00 PM UTC

Drop a GridGroupingControl on a form, add a Form.Load handler and then add this code. private void Form1_Load(object sender, System.EventArgs e) { #region Get the DataSource DataTable dt = new DataTable("MyTable"); int nCols = 4; int nRows = 20; Random r = new Random(123345345); dt.Columns.Add(new DataColumn("boolCol", typeof(bool))); for(int i = 0; i < nCols; i++) dt.Columns.Add(new DataColumn(string.Format("Col{0}", i), typeof(int))); for(int i = 0; i < nRows; ++i) { DataRow dr = dt.NewRow(); for(int j = 1; j <= nCols; j++) dr[j] = r.Next(10); dt.Rows.Add(dr); } #endregion this.gridGroupingControl1.DataSource = dt; this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None; this.gridGroupingControl1.SelectedRecordsChanged += new SelectedRecordsChangedEventHandler(gridGroupingControl1_SelectedRecordsChanged); } private void gridGroupingControl1_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e) { if(e.Action == SelectedRecordsChangedType.Added) { e.SelectedRecord.Record.SetValue("boolCol", true); } else if(e.SelectedRecord != null) { e.SelectedRecord.Record.SetValue("boolCol", false); } }


AS Anna Srinivasan July 28, 2005 01:23 PM UTC

Hi, Click and drag function is working fine. But i got one more problem. The problem is: Q1: If i click individual row , the row is not getting selected (ie: checkbox not getting selected) Q1: I dont want selection back color. (ie: while selecting the row , that default backcolor) Is it possible..! Thanks, Anna


AD Administrator Syncfusion Team July 28, 2005 04:48 PM UTC

I am not sure I fully understand what you are trying to do. But here is a sample that lets you click on the chceckbox and see the row selected. http://www.syncfusion.com/Support/user/uploads/GGC_SelectCheckBox_ecbd9706.zip


AS Anna Srinivasan July 29, 2005 09:05 AM UTC

Hi, Click and click and drag both the things are working fine. Q1: But still i am getting selection back color. [ie for example In text editor u apply ctl+A, that back color is comming right , i dont want that back color in the grid while i am doing click or drag.] I need only checkbox selection(true).I dont want back color. Is it possible..! Thanks, Anna


AD Administrator Syncfusion Team July 29, 2005 09:45 AM UTC

Sorry, but I still do not understand what you want. If you want to use alphablends to draw the selections, then try ssetting: this.gridGroupingControl1.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.DrawAlphablend; If you do not want to see any slection color at all, then try setting: this.gridGroupingControl1.TableOptions.SelectionBackColor = Color.FromArgb(0, Color.Red);

Loader.
Live Chat Icon For mobile
Up arrow icon