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.
Syncfusion Feedback

SelectionChanged event not being fired.

Thread ID:

Created:

Updated:

Platform:

Replies:

64153 Jul 16,2007 10:24 AM UTC Jul 18,2007 06:23 PM UTC Windows Forms 3
loading
Tags: GridControl
Harshal
Asked On July 16, 2007 10:24 AM UTC

Hi,
I am using Syncfusion version 4.4.0.51. I am using virtual Grid. When selection changes, the SelectionChanged event is fired. But when a selected row is deleted, this event is not fired. Let me know how to resolve this issue.

Regards,
Harshal



haneefm [Syncfusion]
Replied On July 16, 2007 07:48 PM UTC

Hi Harshal,

You can handle the RowsRemoving/RowsRemoved event to resolve this issue. Grid.Model.RowsRemoving is fired when grid.Model.Rows.RemoveRange is called. This method is normally only called for a GridControl to actually remove rows from the GridControls internal storage. Below is a code snippet.

this.gridControl1.RowsRemoving += new Syncfusion.Windows.Forms.Grid.GridRangeRemovingEventHandler(gridControl1_RowsRemoving);

void gridControl1_RowsRemoving(object sender, Syncfusion.Windows.Forms.Grid.GridRangeRemovingEventArgs e)
{
Console.WriteLine("Rows Removing....!");
}
Best regards,
Haneef

Harshal
Replied On July 18, 2007 02:20 PM UTC

Hi,

I am actually using virtual grid. The rows are deleted from the DataTable where the data is actually stored.

See the below code snippet:

Assume row 1 is selected.
dataTable.Rows.RemoveAt(1);
gridControl1.ResetVolatileData();
gridControl1.Refresh();

In the above scenario the SelectionChanged event is not fired.
Please let me know to work around this issue.

Regards,
Harshal


Rajagopal [Syncfusion]
Replied On July 18, 2007 06:23 PM UTC

Hi Harshal,

You can listen to the RowDeleted event of the DataTable and clear the existing selection there to make the SelectionChanged trigger. Please try the code below.

// RowDeleted event of the Datatable
dt.RowDeleted += new DataRowChangeEventHandler(dt_RowDeleted);

private void dt_RowDeleted(object sender, DataRowChangeEventArgs e)
{
if(e.Action == DataRowAction.Delete)
{
this.grid.Selections.Clear();
this.grid.Selections.Add(GridRangeInfo.Row(this.grid.CurrentCell.RowIndex));
}
}

Let me know if this helps.

Regards,
Rajagopal

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.

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

;