ListView ItemDatabound data

D

David C

I have a ListView that I want to get the value of a unbound data column
instead of using FindControl. I have a VendorID and Vendor in the
DataSource. I use the following to get the value of a TextBox control

Dim tb As TextBox =
CType(e.Item.FindControl("txtExpenseID"), TextBox)
ddl.SelectedValue = tb.Text

How would I get the value in a Data field named "Vendor" that was not bound
to any control?
p.s. This is all in the ListView_ItemDataBound event.

Thanks.

David
 
G

Guest

I have a ListView that I want to get the value of a unbound data column
instead of using FindControl.  I have a VendorID and Vendor in the
DataSource.  I use the following to get the value of a TextBox control

                Dim tb As TextBox =
CType(e.Item.FindControl("txtExpenseID"), TextBox)
                ddl.SelectedValue = tb.Text

How would I get the value in a Data field named "Vendor" that was not bound
to any control?
p.s. This is all in the ListView_ItemDataBound event.

Thanks.

David

David, try this

ListViewDataItem dataItem = (ListViewDataItem)e.Item;
DataRowView drv = (DataRowView)dataItem.DataItem;
companyName.Text = drv["Vendor"].ToString();
 

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

Getting unbound ListView data values 0
DropDown in ListView 3
Error filling DropDownList on ListView 2
ListView Insert 4
Populate tfoot in ListView 0
Insert on empty ListView 2
Nested ListView 6
ListView control 4

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top