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.

Reg: Grid Grouping Control

Thread ID:

Created:

Updated:

Platform:

Replies:

32147 Jul 22,2005 09:42 AM Jul 29,2005 05:45 AM Windows Forms 7
loading
Tags: GridControl
Anna Srinivasan
Asked On July 22, 2005 09:42 AM

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

Administrator [Syncfusion]
Replied On July 22, 2005 10:01 AM

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);
	}
}

Anna Srinivasan
Replied On July 22, 2005 10:39 AM

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

Administrator [Syncfusion]
Replied On July 22, 2005 12:00 PM

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); } }

Anna Srinivasan
Replied On July 28, 2005 09:23 AM

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

Administrator [Syncfusion]
Replied On July 28, 2005 12:48 PM

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

Anna Srinivasan
Replied On July 29, 2005 05:05 AM

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

Administrator [Syncfusion]
Replied On July 29, 2005 05:45 AM

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);

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.

;