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.

Deleting or hiding a row in a collection

Thread ID:

Created:

Updated:

Platform:

Replies:

24104 Jan 28,2005 02:32 AM Feb 14,2005 03:21 PM Windows Forms 7
loading
Tags: GridControl
Jose Egea
Asked On January 28, 2005 02:32 AM

I''m using a IBinding collection with the GDBG. I want to mark the item in the collection as isdeleted when the user press the delete button. Using the RemoveRange method the item is removed from the collection and I can''t catch it in my Save method. How can I hide or delete the row in the grid, not in the collection, until I use my Save method?

Administrator [Syncfusion]
Replied On January 28, 2005 02:37 AM

You can hide a row using grid.Model.Rows.Hidden. //hide row 2 this.gridDataBoundGrid1.Model.Rows.Hidden[2] = true;

Jose Egea
Replied On January 28, 2005 03:13 AM

Thanks. It works, but I lose the cursor in the grid and it''s still pointing to the same row. This way if I try to edit the current record after deleting it pops up the deleted row. Is there a better way? or how can I manage the cursor pointing to next, previous if last, ... row?

Administrator [Syncfusion]
Replied On January 28, 2005 04:03 AM

You change change the current position (where the header triangle is) by setting grid.Binder.CurrentPosition property.

Jose Egea
Replied On January 28, 2005 05:00 AM

But Clay, how can I know the previous or next visible position? because it can be hidden too. And the grid can be resorted. Thanks in advance for your help

Administrator [Syncfusion]
Replied On January 28, 2005 05:17 AM

You can loop through grid.Rows.Hidden until you find a False value. This will give you the grid RowIndex of the next or previous visible row (depending how how you run your loop). You can then call grid.Binder.RowIndexToPosition to get the position value, and then set this value into grid.Binder.CurrentPosition.

Jose Egea
Replied On February 14, 2005 12:41 PM

Hello: I have done it this way and it works. But today I have discovered that I can make a hidden row visible with a double click below the triangle header in the previous visible row, you know, in the separator header line between two visible rows where I have hidden my row. How can I solve that? Best regards

Administrator [Syncfusion]
Replied On February 14, 2005 03:21 PM

You can prevent the doubleclick from resizing and showing the columns by handling the ResizingColumns event.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason.Equals(GridResizeCellsReason.DoubleClick))
	{
		e.Cancel = true;
	}
}

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.

;