Solved

Delete dataGrid row bind to dataTable with Delete button

Posted on 2004-09-18
2
220 Views
Last Modified: 2008-02-26
Hi all,

I'm trying to delete a row through datagrids currentrowindex with a good old button.
Thing is I'm filling up the datagrid (dataset) with comboboxes and textboxes, yadayada...
Problem is when I delete the row using:

         dataTable1.Rows[dataGrid1.CurrentRowIndex].Delete();

In the dataTable it's not always the right one.
For instance if I sort the datagrid all goes bad. (This is disabled for the moment to be able to move on)

Is there a way to trigger the delete-row-event in the datagrid itself?
DataGrid is readonly though to remove the 'new' row!
Is the only way to insert a new column with a unique key?

Thanks,
Pierre
0
Comment
Question by:Targeted
2 Comments
 
LVL 5

Accepted Solution

by:
tomasX2 earned 125 total points
ID: 12094006
0
 

Author Comment

by:Targeted
ID: 12130965
Thanks tomasX2 for the fast answer...

This solved my problem.
Regards,
Pierre
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question