converting datagrid item into row

  • Thread starter Thread starter Lerp
  • Start date Start date
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 :)
 
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.
 
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 :)
 
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 :)
 
Back
Top