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
close icon

deleting a selected record

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?

4 Replies

AD Administrator Syncfusion Team December 14, 2006 06:00 AM UTC

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


OA Ossama Alami December 14, 2006 05:09 PM UTC

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.


JN Jayakumar Natarajan Syncfusion Team December 14, 2006 11:54 PM UTC

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


AD Administrator Syncfusion Team December 15, 2006 08:46 PM UTC

Thanks very much, thats exactly what I needed.

Loader.
Live Chat Icon For mobile
Up arrow icon