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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Multiple Cells Selection in Grid Control

Thread ID:

Created:

Updated:

Platform:

Replies:

78637 Dec 20,2008 07:24 PM UTC Dec 23,2008 05:27 AM UTC WinForms 3
loading
Tags: Grouping
Ankit Thakkar
Asked On December 20, 2008 07:24 PM UTC

Hi,

I have a requirement in Grid Control to select multiple cells by either holding Ctrl button and Clicking on Cells Or Click a Cell and drag to select multiple cells and then right Click on these selected cells and update some status.

Please let me know how to achieve this in Grid Control.

I need this as early as possibele.

Many Thanks..


Jisha Joy [Syncfusion]
Replied On December 22, 2008 06:48 AM UTC

Hi Ankit,

Please try the following codes and let me know if this helps.

this.gridControl1.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;
this.gridControl1.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Jisha


Ankit Thakkar
Replied On December 22, 2008 02:12 PM UTC

Thanks for your code. Using this, I can able to Select multiple cells which is fine. Now, the issue is after selecting the cells, on my right click on the selected cells, I require the selected cells info like rownum and ColNum of selected cells.

Pls let me know the event which I can use to achieve this. I want this event to fire when I right Click on any of selected cells and how to fetch selected cells info

Pls help me with this..

Thanks..

>Hi Ankit,

Please try the following codes and let me know if this helps.

this.gridControl1.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;
this.gridControl1.SelectCellsMouseButtonsMask = MouseButtons.Left;


Regards,
Jisha




Jisha Joy [Syncfusion]
Replied On December 23, 2008 05:27 AM UTC

Hi Ankit,


This can be achieved by handling the MouseDown event and can check for MouseButtons. You can get the selected ranges from the method GetSelectedRanges. You can use GetCellsInfo method to get the style information from ranges. Please check out the code:

this.gridControl1.MouseDown += new MouseEventHandler(gridControl1_MouseDown);
this.gridControl1.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;
this.gridControl1.SelectCellsMouseButtonsMask = MouseButtons.Left;

void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{

GridRangeInfoList rangeList;

this.gridControl1.Selections.GetSelectedRanges(out rangeList, true);
if (rangeList.Count > 0)
{

foreach (GridRangeInfo range in rangeList)
{

GridStyleInfo[] info = gridControl1.GetCellsInfo(range);

for (int i = 0; i < info.GetLength(0); i++)
{
Console.WriteLine(info[i].Text);
}

}


}
}
}

Please let me know if this helps you out.

Regards,
Jisha



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.

Warning Icon 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.Close Icon

;