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 row in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

57909 Mar 13,2007 05:00 PM Mar 14,2007 12:58 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 13, 2007 05:00 PM

I am having difficulties when deleting a row from the grid. I use a checkbox to determine if a row is selected. If it is selected and I click delete I remove the row with the below code. Now if I don't persist the datatable at this point using AcceptChanges it breaks the second function below that I use to get the selected line in the grid.

e.Table.UnsortedRecords.IndexOf(gr);

This line returns the proper index in the datatable if there are no deleted rows. Once a deleted row is in the datatable it shifts all the indexes in the datatable but technically the indexes haven't changed because the datatable only has them marked to delete.

Is there a way I can get the index to the datatable without accepting changes on the datatable?

for (int i = 0; i < this.ggcDWP.Table.Records.Count; i++)
{
DataRowView drv = (DataRowView)this.ggcDWP.Table.Records[i].GetData();
DailyWeightingPatternDataSet.DWP_PARENTRow drw = (DailyWeightingPatternDataSet.DWP_PARENTRow)drv.Row;
if (bool.Parse(drw.selected.ToString()))
{
drw.selected = "False";
this.ggcDWP.Table.Records[i].Delete();
this.ggcDWP.NumberCheckedItems = 0;
}

private void ggcDWP_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.EnterRecordComplete
&& e.Record is GridRecord)
{
GridRecord gr = (GridRecord)e.Record;
int index = e.Table.UnsortedRecords.IndexOf(gr);
if (this.evntSelectionChanged != null)
this.evntSelectionChanged(index);
}
}

Administrator [Syncfusion]
Replied On March 14, 2007 12:58 PM

Hi Mike,

We are really sorry for the delay in responding. We have tested the mentioned issue. We could not reproduce the issue here. Could you please provide us a sample having the issue? This will help us to resolve the issue soon.

Thanks for choosing Syncfusion products.

Regards,
Haneef

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.

;