Home All Groups Group Topic Archive Search About
Author
22 May 2006 6:44 PM
Philipp
Hi all,

Is there a way to retrieve the rowstate of a row in a datagridview
(added - modified - deleted - ...) ?
Does someone have some info on this or a document/url where I can read
about it?

Thanks in advance!

Philipp

Author
22 May 2006 9:44 PM
Kevin Spencer
You're confusing a DataGridViewRow with the underlying data source. A
DataGridViewRow does not have any such properties. A System.Data.DataRow
does. But you need to confirm to us that your DataGridView is bound to a
table first. If so, the DataGridViewRow has a "DataBoundItem" property which
is of type "object." If it is bound to a DataTable, the DataBoundItem
property will be a DataRowView (most likely). A DataRowView has a "Row"
property which is the underlying DataRow. And *that* has a RowState
property.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

The man who questions opinions is wise.
The man who quarrels with facts is a fool.

Show quote
"Philipp" <sty***@hotmail.invalid.com> wrote in message
news:uLAkPCdfGHA.3652@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> Is there a way to retrieve the rowstate of a row in a datagridview
> (added - modified - deleted - ...) ?
> Does someone have some info on this or a document/url where I can read
> about it?
>
> Thanks in advance!
>
> Philipp
Author
23 May 2006 8:06 PM
Philipp
Kevin Spencer wrote:
> You're confusing a DataGridViewRow with the underlying data source. A
> DataGridViewRow does not have any such properties. A System.Data.DataRow
> does. But you need to confirm to us that your DataGridView is bound to a
> table first. If so, the DataGridViewRow has a "DataBoundItem" property which
> is of type "object." If it is bound to a DataTable, the DataBoundItem
> property will be a DataRowView (most likely). A DataRowView has a "Row"
> property which is the underlying DataRow. And *that* has a RowState
> property.
>

Thanks!
The DataGridView is indeed bound to a DataTable.
I will try this when I'm back at work in a couple of days.

Thanks for the answer, I'll let you know if it works!

Philipp
Author
26 May 2006 1:08 PM
Philipp
Show quote
"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> schreef in bericht
news:O11ipjefGHA.2068@TK2MSFTNGP02.phx.gbl...
> You're confusing a DataGridViewRow with the underlying data source. A
> DataGridViewRow does not have any such properties. A System.Data.DataRow
> does. But you need to confirm to us that your DataGridView is bound to a
> table first. If so, the DataGridViewRow has a "DataBoundItem" property
> which is of type "object." If it is bound to a DataTable, the
> DataBoundItem property will be a DataRowView (most likely). A DataRowView
> has a "Row" property which is the underlying DataRow. And *that* has a
> RowState property.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull

It is exactly as you describe ... the only problem is that when the
datagridview is bound, the rowstate of all datarows are of type "added".
When something is changed in the DataGridView the state of the underlying
row still is "added".
Am I doing something wrong here ?

Thanks


Greets,
Philipp

AddThis Social Bookmark Button