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

Ctrl+A in GridGroupingControl

Hi, How do i do select all function in gridgrouping control..? I need this functionality if user click 0,0 positiion all values present in this grid should be selected like excel sheet. Thanks, Anna

4 Replies

AD Administrator Syncfusion Team June 20, 2005 04:41 AM

Are you using the record selection support in GridGroupingControl (and not teh selection support inherited from GridControlbase)? //GridGroupingControl record selections this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None; this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; If so, you can handle the TableControlCellClick event and select the records there.
private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
	GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
	if(style.TableCellIdentity.TableCellType == GridTableCellType.TopLeftHeaderCell)
	{
		this.gridGroupingControl1.BeginUpdate();
		foreach(GridRecord rec in gridGroupingControl1.Table.Records)
		{
			if(!rec.IsSelected())
				rec.SetSelected(true);
		}
		this.gridGroupingControl1.EndUpdate(true);
	}
}


AS Anna Srinivasan June 20, 2005 05:37 AM

Hi, Code u have sent that is working fine. I need to select the item through keyboard.How..? Thanks, Anna


AD Administrator Syncfusion Team June 20, 2005 07:01 AM

You can handle the TablControlCurrentCellControlKeyMessage event.
private void gridGroupingControl1_TableControlCurrentCellControlKeyMessage(object sender, GridTableControlCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys) ((int)e.Inner.Msg.WParam) & Keys.KeyCode;
	if(keyCode == Keys.A && e.Inner.Msg.Msg == 0x100 //WM_KEYDOWN
		&& 0 != (Control.ModifierKeys & Keys.Control))
	{
		//ctl+A pressed
		this.gridGroupingControl1.BeginUpdate();
		foreach(GridRecord rec in gridGroupingControl1.Table.Records)
		{
			if(!rec.IsSelected())
				rec.SetSelected(true);
		}
		this.gridGroupingControl1.EndUpdate(true);
		e.Inner.Handled = true;
		e.Inner.Result = true;
	}
}


BR Badri Rajani Kanth February 8, 2006 01:12 PM

HI, If there are few thousands of records, then this was of selecting all the records is taking lot of time and this is really a performance issue. I am wondering is there any single method like SelectAllRecords()/AddAllRecords to the SelectedRecords collection? (as we have GGC.Table.SelectedRecords.Clear() ).. Plz inform me. Rgds Rajani Kanth >You can handle the TablControlCurrentCellControlKeyMessage event. > >
>private void gridGroupingControl1_TableControlCurrentCellControlKeyMessage(object sender, GridTableControlCurrentCellControlKeyMessageEventArgs e)
>{
>	Keys keyCode = (Keys) ((int)e.Inner.Msg.WParam) & Keys.KeyCode;
>	if(keyCode == Keys.A && e.Inner.Msg.Msg == 0x100 //WM_KEYDOWN
>		&& 0 != (Control.ModifierKeys & Keys.Control))
>	{
>		//ctl+A pressed
>		this.gridGroupingControl1.BeginUpdate();
>		foreach(GridRecord rec in gridGroupingControl1.Table.Records)
>		{
>			if(!rec.IsSelected())
>				rec.SetSelected(true);
>		}
>		this.gridGroupingControl1.EndUpdate(true);
>		e.Inner.Handled = true;
>		e.Inner.Result = true;
>	}
>}
>

Loader.
Live Chat Icon For mobile
Up arrow icon