469,641 Members | 1,189 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

converting datagrid item into row

Hi all,

What's the syntax for creating a row out of the current item in a datagrid?
Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)
Nov 18 '05 #1
3 2372
This could work only during the same request when DataGird is databound.
Then you could access the data source row via e.Item.DataItem, that is,
DataItem property of the DataGridItem. By the way, when you bind to
DataSet,DataTable or DataView, type of the e.Item.DataItem is
System.Data.DataRowView (DataView's item type), with DataReader it is
System.Data.Common.DBDataRecord and for other types it is the type of the
custom item.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Lerp" <ad***@officience.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a datagrid?

Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)

Nov 18 '05 #2
Ok thank you Teemu ,

What I am really trying to get at is the parentrow for the current DataItem
of the datagrid. You see, I have a dataset comprised of 3 tables
(Employee, Client and Order) with 2 relations as well. In my aspx page I
have a datagrid bound to this dataset, howver, the last two columns of my
row are ID fields...so what I am doing is calling a sub on itemdatabound to
retrieve the parent row for the given datagrid row so I can access and
display Employee and Client names instead of ID values. Can I still do this
with the DataRowView Object?

Cheers, Lerp :)
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:#m**************@TK2MSFTNGP11.phx.gbl...
This could work only during the same request when DataGird is databound.
Then you could access the data source row via e.Item.DataItem, that is,
DataItem property of the DataGridItem. By the way, when you bind to
DataSet,DataTable or DataView, type of the e.Item.DataItem is
System.Data.DataRowView (DataView's item type), with DataReader it is
System.Data.Common.DBDataRecord and for other types it is the type of the
custom item.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Lerp" <ad***@officience.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a

datagrid?


Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)


Nov 18 '05 #3
hi agian,

So, could I use the row property of the datarowview to make a new datarow so
I can get to the parent row?

Cheers, Lerp :)

"Lerp" <ad***@officience.ca> wrote in message
news:#p**************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a datagrid?

Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Matthew Wieder | last post: by
4 posts views Thread by John Doe | last post: by
reply views Thread by BK Kim | last post: by
2 posts views Thread by Daniel Walzenbach | last post: by
4 posts views Thread by tshad | last post: by
25 posts views Thread by Blasting Cap | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.