Rod
Rod

Reputation: 15455

databinding to a datarow

I'm using DataBindings to an untyped DataTable like the following

textbox1.DataBindings.Add("Text", _dataTable, columnName );

Now the databinding works fine, however, I was checking the state of the row (after changing a value, of course) and it shows Unchanged. Just wondering shouldn't that be Modified?

_dataTable.Rows[0]
{System.Data.DataRow}
    HasErrors: false
    ItemArray: {object[11]}
    RowError: ""
    RowState: Unchanged
    Table: {}

Upvotes: 0

Views: 565

Answers (2)

Rod
Rod

Reputation: 15455

I used _dataTable.BeginEdit() and _dataTable.EndEdit() to changed the row state to Modified.

Upvotes: 0

Reza ArabQaeni
Reza ArabQaeni

Reputation: 4907

call _dataTable.AcceptChanges() to commit your changes to row.

Upvotes: 1

Related Questions