Getting unbound ListView data values

D

David C

How do I retrieve the data values of a Datasource used in a ListView but are
not bound or displayed to any controls on the ListView?
Below is how I do that in the ItemDataBound event of the ListView.

'Get the item and row objects.
Dim dataItem As ListViewDataItem = CType(e.Item, ListViewDataItem)
Dim rowView As DataRowView = CType(dataItem.DataItem, DataRowView)
' Retrieve the Vendor value for the current item.
Dim intVendorID As Int32 = Convert.ToInt32(rowView("VendorID"))

I want to get the data values in the ItemInserting and the ItemUpdating
events.
Below is how I am getting them from controls on the current record being
inserted or updated.

ItemInserting

Dim ddl As DropDownList =
CType(e.Item.FindControl("ddlPeopleLinkID"), DropDownList)
e.Values("PeopleLinkID") = ddl.SelectedValue

ItemUpdating

Dim ddl As DropDownList =
CType(lvIncExpTrans.EditItem.FindControl("ddlPeopleLinkID"), DropDownList)
e.NewValues("PeopleLinkID") = ddl.SelectedValue


Thank you.

David
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,821
Messages
2,569,748
Members
45,726
Latest member
RaleighAll

Latest Threads

Top