From: David C on 24 Sep 2009 16:57 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
From: Alexey Smirnov on 27 Sep 2009 16:36 On Sep 24, 10:57 pm, "David C" <dlch...(a)lifetimeinc.com> wrote: > 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();
|
Pages: 1 Prev: how to Get ID in global.asax page Next: Repeater DataBinding on PostBack and base.DataBind() |