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.

Regarding Grid Control selecting rows and added to the Second grid

Thread ID:

Created:

Updated:

Platform:

Replies:

73707 May 15,2008 06:28 AM May 26,2008 10:19 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 15, 2008 06:28 AM

Hi

I am using the Grid control.I have set the Allow selection to Alpha,Table and Row,Property like Excel like selection and Excel like property is to be set to true which allow me to select the rows by using the ctrl key.say i wll selct row no. 1,4,5,8,10 rows out of 10 rows but i am not able get the list of the selected rows in the grid and I want also to add the Selected list in some another grid control. Plz help me.

I shal thank for you

Best Regards
Vikas Chopra



Sri Rajan [Syncfusion]
Replied On May 26, 2008 10:19 AM

Hi Vikas,

Thank you for your patience.

To get the selected rows in a GridControl, you need to use Selections.GetSelectedRanges method. To copy the selected rows in one grid control and pasted it in another grid control, you need to use Model.CutPaste.Copy() and Model.CutPaste.Paste() methods. Please refer the below code for more details.

private void buttonAdv1_Click(object sender, EventArgs e)
{
//To Get the Selected Ranges.
GridRangeInfoList ranges;
this.gridControl1.Model.Selections.GetSelectedRanges(out ranges, true);
foreach (GridRangeInfo sel in ranges)
{
Console.WriteLine("First Row : " + sel.Top.ToString());
}
//To copy range of row from one grid to another.
this.gridControl1.Model.CutPaste.Copy();
this.gridControl2.Focus();
this.gridControl2.CurrentCell.MoveTo(1, 1);
this.gridControl2.Model.CutPaste.Paste();
this.gridControl2.Model.Refresh();
}


Best Regards,
Srirajan



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.

;