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

datagrid row <--> datasetrow

P: n/a
If I know the datagrid row there is a method to get the dataset row?

Now I use the dataset id the find it out,

id=this.dataGrid1[this.dataGrid1.CurrentRowIndex,0]; // column 0 is id

DataRow drRow=this.dataSet1.Tables["Table"].Rows.Find(id);

but I don't like it very much, there is a "cleaner" way the get the dataset
row?
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Zurcher,

The data grid is really bound to the view on the data. If you bound to
a data table, then the DefaultView property exposes the DataView that the
grid binds to. You will want to get the row number in the grid, and then
get the appropriate row through the DataView object.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zürcher See" <aq****@cannabismail.com> wrote in message
news:10***************@fuchs.cyberlink.ch...
If I know the datagrid row there is a method to get the dataset row?

Now I use the dataset id the find it out,

id=this.dataGrid1[this.dataGrid1.CurrentRowIndex,0]; // column 0 is id

DataRow drRow=this.dataSet1.Tables["Table"].Rows.Find(id);

but I don't like it very much, there is a "cleaner" way the get the dataset row?

Nov 15 '05 #2

P: n/a
You means something like:
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> schrieb
im Newsbeitrag news:eg**************@TK2MSFTNGP12.phx.gbl...
Zurcher,

The data grid is really bound to the view on the data. If you bound to a data table, then the DefaultView property exposes the DataView that the
grid binds to. You will want to get the row number in the grid, and then
get the appropriate row through the DataView object.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zürcher See" <aq****@cannabismail.com> wrote in message
news:10***************@fuchs.cyberlink.ch...
If I know the datagrid row there is a method to get the dataset row?

Now I use the dataset id the find it out,

id=this.dataGrid1[this.dataGrid1.CurrentRowIndex,0]; // column 0 is id

DataRow drRow=this.dataSet1.Tables["Table"].Rows.Find(id);

but I don't like it very much, there is a "cleaner" way the get the

dataset
row?


Nov 15 '05 #3

P: n/a
I tried something like:

DataRow
drRow=this.dataSet1.Tables["Table"].DefaultView[this.dataGrid1.CurrentRowInd
ex].Row;

but this does not work

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> schrieb
im Newsbeitrag news:eg**************@TK2MSFTNGP12.phx.gbl...
Zurcher,

The data grid is really bound to the view on the data. If you bound to a data table, then the DefaultView property exposes the DataView that the
grid binds to. You will want to get the row number in the grid, and then
get the appropriate row through the DataView object.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zürcher See" <aq****@cannabismail.com> wrote in message
news:10***************@fuchs.cyberlink.ch...
If I know the datagrid row there is a method to get the dataset row?

Now I use the dataset id the find it out,

id=this.dataGrid1[this.dataGrid1.CurrentRowIndex,0]; // column 0 is id

DataRow drRow=this.dataSet1.Tables["Table"].Rows.Find(id);

but I don't like it very much, there is a "cleaner" way the get the

dataset
row?


Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.