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