By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,899 Members | 1,353 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,899 IT Pros & Developers. It's quick & easy.

How to Delete rows from a sorted DataGrid

P: n/a
DBW
I am using a DataGrid control with a DataTable as a data source.
Everything seem to work fine until the DataGrid is sorted by clicking on the
column header. After that I do not know how to associate the DataGrid
selected row with a DataTable row.

Here is the code that I use to delete a row how can I

private void DeleteLine_Click(object sender, System.EventArgs e)
{ int Idx = ICD_Grid.CurrentRowIndex;
int Idx2= m_CurrencyManager.Position;

if (Idx>=0)
{
m_DataTable.Rows.RemoveAt(Idx);
ICD_Grid.CurrentRowIndex=Idx;
}
}

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.