Diamonds,
This you did not ask. But don't use the remove if you wants to update a
database later.
A "remove" removes a row from a datatable, so the update does not know
anything anymore from that row.
A "delete" set a rowstate, so that the update can use that to delete the row
from the database.
(This rowstate is not set as the row was new inserted).
The rowstates are cleaned and the rows really removed by the dataset or by
the command. Datatable.acceptchanges.
I hope this helps,
Cor
"Diamonds" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> So I could use dr to .Remove() from the datatable?
> Even though the datarow came from the view, they are still the same
> reference?
>
> Thnx for your help. I'm really worreid that I'm doing this the long
> way.
>
> Cheers,
>
> Cor Ligthert [MVP] wrote:
>> Diamonds,
>>
>> To get datarow from the current datarowview (the rows from a dataview) is
>> very simple.
>>
>> dr = drv.Row;
>>
>> I hope this helps,
>>
>> Cor
>>
>> "Diamonds" <(E-Mail Removed)> schreef in bericht
>> news:(E-Mail Removed)...
>> > Hello,
>> >
>> > In my DataGrid for ASP.NET C#,
>> >
>> > In the UI the user adds rows to the DataGrid and the values are saved
>> > in a DataTable.
>> >
>> > The DataTable is displayed by using a DataView. The DataView is sorted
>> > then bound to the DataGrid.
>> >
>> > The DataGrid allows editing. It knows which row to change based on
>> > Item.ItemIndex. However, it is using the ItemIndex of the DataView. I
>> > need to map the DataView index to the DataTable index to edit the
>> > correct row.
>> >
>> > The sort is = "Col1, Col2 ASC".
>> >
>> >
>> > Am I doing this correctly?
>> > How would I get the related DataTable row?
>> >
>
|