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 a selected record

Thread ID:

Created:

Updated:

Platform:

Replies:

53460 Dec 13,2006 07:19 PM Dec 15,2006 03:46 PM Windows Forms 4
loading
Tags: GridControl
Ossama Alami
Asked On December 13, 2006 07:19 PM

Hi,

If I have a selected record which is then deleted from the list the gridgroupingcontrol does not seem to raise a selectedrecordchanged event, which I would expect it would.

In either case, I need to be able to handle this event in some fashion, and I tried looking around and handling RecordDeleted to check if that record was selected, but RecordDeleted never seems to be called.

Am I missing something?

Administrator [Syncfusion]
Replied On December 14, 2006 01:00 AM

Hi Ossama,

By default, the GridGroupingControl have two type of selection modes (http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=344). i.e., record based selection and cell based selection. The SelectedRecordChanged event only fires in record based selection mode. If you want to detect the selection changes in the cell based selection mode, you need to handle the TableModel.SelectionChanging event.

Do you want to cancel the default record deletion? If so, you can set the TableDescriptor.AllowRemove property to FALSE.

Kindly try it and let us know if you need any further assistance.

Best regards,
Haneef

Ossama Alami
Replied On December 14, 2006 12:09 PM

I am in the record-based selection mode. The problem is that when a selected record is removed from the underlying binding list I don't get a selectedrecordchanged event, so I have no way of knowing if selection has changed. I use selection in this grid to drive another part of the application, so I need to know when it has changed.

Jayakumar Natarajan [Syncfusion]
Replied On December 14, 2006 06:54 PM

Hi Ossama,
Grid.SourceListRecordChanging / SourceListRecordChanged events are raised when the records are removed from the underlying list. The selection events are disabled when the records are removed and cleared. You can make use of the SourceListListChanged event to detect if the record to be revmoved is selected:



void gridGroupingControl1_SourceListListChanged(object sender, Syncfusion.Grouping.TableListChangedEventArgs e)
{
Console.WriteLine("gridGroupingControl1_SourceListListChanged");

if (e.ListChangedType == ListChangedType.ItemDeleted)
{
Console.WriteLine("Is the record selected? :" + this.gridGroupingControl1.Table.Records[e.NewIndex].IsSelected());
}
}


Best regards,
Jay

Administrator [Syncfusion]
Replied On December 15, 2006 03:46 PM

Thanks very much, thats exactly what I needed.

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.

;