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.

model.Options.DisplayEmptyColumns is letting me drag into invisible columns

Thread ID:

Created:

Updated:

Platform:

Replies:

7186 Sep 15,2003 02:51 PM Sep 16,2003 03:57 PM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 15, 2003 02:51 PM

Hi, I have a DataBoundGrid(1.6.1.5) with around 50 columns. They are hidden using gridModel.HideCols[nn] = true method. When I set model.Options.DisplayEmptyColumns to true, it is giving me a visual effect that I want. But, when I drag my last column to the right, it is letting me drop into the empty column. Somehow it is thinking those invisible columns are visible. Then my draged column becomes invisible and get lost. I tried handling grid.ColsMoving event handler. It is giving me e.From = 11 and e.Target = 37 when I am seeing only two columns. Can you please help me? thanks, - Reddy

Administrator [Syncfusion]
Replied On September 16, 2003 02:19 AM

I think I was able to avoid the bad drop in the attached sample using a ColsMoving handler. But I do not know of a way of not showing the drop cursor past the good columns. If you just wanted to drop the column to the right of teh last column if the user tried to drop the col past the good columns, then I think you could cancel teh current drop in ColsMoving, and call MoveCols to position the column correctly. Here is sample code:
private void gridModel_ColsMoving(object sender, GridRangeMovingEventArgs e)
{
	Console.WriteLine("gridModel_ColsMoving " + e.Target.ToString());
	if(e.Target > this.gridDataBoundGrid1.Model.ColCount)
	{
		e.Cancel = true;
                this.gridDataBoundGrid1.Model.Cols.MoveRange(e.From, e.Count, this.gridDataBoundGrid1.Model.ColCount);
	}
}

Administrator [Syncfusion]
Replied On September 16, 2003 09:59 AM

Clay, Your workaround has a problem. 1. Run your application. 2. Select Col0, Col1 and Col2. 3. Drag and Drop after last column (col 8). 4. Notice that now col0, col1 and col2 are missing. How can we fix this problem? FYI, Windows Explorer (view detail grid on right side) implements a nice feature where you can drop any column past the last column and it will simply move it to the last. This would be nice to have. thanks, - Reddy

Administrator [Syncfusion]
Replied On September 16, 2003 03:57 PM

This seems to work...
private void gridModel_ColsMoving(object sender, GridRangeMovingEventArgs e)
{
	if(e.Target + e.Count - 1 > this.gridDataBoundGrid1.Model.ColCount )
	{
		e.Cancel = true;
	 this.gridDataBoundGrid1.Model.Cols.MoveRange(e.From, e.Count, this.gridDataBoundGrid1.Model.ColCount - e.Count + 1);
	}
}

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.

;