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.

Ctrl+A in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30516 Jun 20,2005 04:57 AM Feb 8,2006 01:12 PM Windows Forms 4
loading
Tags: GridControl
Anna Srinivasan
Asked On June 20, 2005 04:57 AM

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

Administrator [Syncfusion]
Replied On June 20, 2005 05: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);
	}
}

Anna Srinivasan
Replied On June 20, 2005 06:37 AM

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

Administrator [Syncfusion]
Replied On June 20, 2005 08: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;
	}
}

Badri Rajani Kanth
Replied On 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;
>	}
>}
>

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.

;