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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Mutile Selections ComboBox

Thread ID:





14848 Jun 7,2004 06:30 AM UTC Jun 8,2004 01:53 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On June 7, 2004 06:30 AM UTC

I have a DataBoundGrid with a ComboBox column and I would like the user to be able to select mutiple rows then when they change the option in the combo box in one of the selected rows, all of the other selected rows change their options to match. That would save my users a lot of hassle. Could you give me any pointers please? Thanks, Mark

Administrator [Syncfusion]
Replied On June 7, 2004 06:59 AM UTC

You can try doing this in the CurrentCellChanged event.
private void gridDataBoundGrid1_CurrentCellChanged(object sender, System.EventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.ColIndex == 2) //id combo column somehow
		GridRangeInfo range = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange;
		if(!range.IsEmpty && range.Contains(cc.RangeInfo))
			range = range.IntersectRange(GridRangeInfo.Col(cc.ColIndex));
			int position = this.gridDataBoundGrid1.Binder.CurrentPosition;
			this.gridDataBoundGrid1.Model.ChangeCells(range, cc.Renderer.ControlText);
			this.gridDataBoundGrid1.Binder.SetCurrentPosition(position, true);

Administrator [Syncfusion]
Replied On June 8, 2004 01:19 PM UTC

Thanks Clay, that worked a treat. The code works great for block selections i.e. rows 1 though 6 but is there a way to expand the code to work for disjointed selections ie. selected rows 1,4,8,33 when the user selects via control+click. Is there a way to loop through the selected ranges in turn? Thanks, Mark

Administrator [Syncfusion]
Replied On June 8, 2004 01:53 PM UTC

Instead of GridRangeInfo range = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange; that only looks at the active range, you could try the same code in this type of loop foreach(GridRangeInfo range in this.gridDataBoundGrid1.Selections.Ranges) { //same code }


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon