converting datagrid item into row

L

Lerp

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 :)
 
T

Teemu Keiski

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.
 
L

Lerp

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 :)
 
L

Lerp

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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top