I have a listview with some data bound to it.
In this data are column for an address.
How would I go about accessing these data items in code behind so I can concatenate them into one easy variable and miss out columns that have no data in, i have fields:
address address1 town county postcode
I don't have a problem with the concatenation just accessing the data items.
Thanks J.
UPDATED
I am getting data out via a dataset and binding it to a listview.
Is it possible to access data items in the code behind to format or do whatever i want with them then showing it in the list view such as, concatenating the address fields into one variable?
so instead of writing:
DataBinder.Eval(Container.DataItem, "address") & ", " & DataBinder.Eval(Container.DataItem, "address1") & ", " & DataBinder.Eval(Container.DataItem, "town") etc...
in the actual list view i could do this in the code behind in a string variable then show the variable in the list view?
'select command
Dim cmdSchedule As SqlCommand = New SqlCommand()
cmdSchedule.Connection = keypadSQL
cmdSchedule.CommandText = "spSchedule"
cmdSchedule.CommandType = CommandType.StoredProcedure
'data adapter
Dim daSchedule As SqlDataAdapter = New SqlDataAdapter
daSchedule.SelectCommand = cmdSchedule
'data set
Dim dsSchedule As DataSet = New DataSet()
daSchedule.Fill(dsSchedule, "Schedule")
lvSchedule.DataSource = dsSchedule
lvSchedule.DataBind()
cmdSchedule.Dispose()