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

grid selecting multiple rows

Thread ID:

Created:

Updated:

Platform:

Replies:

103060 Mar 27,2012 04:46 PM UTC Apr 10,2012 04:20 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Smitha
Asked On March 27, 2012 04:46 PM UTC

Hi,

I want to be able to do a delete on multiple rows for the grid control. I am using windows forms, C#

I have a grid with a context menu
On right click, the user can choose to add, delete.

He could select some rows and choose to delete all at once.

How do I enable selection of multiple rows. and then delete
What events should I use.

Thanks
Smitha



Mercy C [Syncfusion]
Replied On March 30, 2012 01:49 PM UTC

Hi Smitha,

Thanks for your interest in Syncfusion products.

To select multiple rows, set the "ListBoxselectionMode" to "MultiExtended".

this.gridControl1.ListBoxSelectionMode = SelectionMode.MultiExtended;

You can handle "contextMenuStrip1.ItemClicked" to check if the menu option selected is "Delete" to delete the rows from the grid.

void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.Text == "Delete")
{
if (this.gridControl1.Selections.Count > 0)
{
GridRangeInfoList ranges = this.gridControl1.Selections.Ranges;
foreach (GridRangeInfo r in ranges)
{
this.gridControl1.Rows.RemoveRange(r.Top, r.Bottom);
}
}
}
}

Please refer to the sample in the following link
http://www.syncfusion.com/downloads/Support/DirectTrac/89778/WindowsFormsApplication76-243854808.zip

Regards,
Mercy.C


Smitha
Replied On April 5, 2012 04:23 PM UTC

Hi Mercy,

What is the difference between
theGrid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;
this.theGrid.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Any;

and

theGrid.ListBoxSelectionMode = SelectionMode.MultiExtended;

Thanks
Smitha


Ragamathulla B [Syncfusion]
Replied On April 10, 2012 04:20 AM UTC

Hi Smitha,

Thank you for your interest in syncfusion products,

Please refer to the following UG link which is help to know the differences.


http://help.syncfusion.com/ug_94/User%20Interface/Windows%20Forms/Grid/Documents/43462recordbasedselection.htm


http://help.syncfusion.com/ug_94/User%20Interface/Windows%20Forms/Grid/Documents/41423selectionmodes.htm


You can have context menu on right click on column headers by using ‘TableControlCellClick’ event along with the following code. Please refer the following code to achieve the behavior.

Sample link:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=847071641385806.zip

Let me know if you have any further concerns.


Regards,
Ragamathullah B.


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

;