binding a dropdown list in web app

  • Thread starter Thread starter rbutch
  • Start date Start date
R

rbutch

guys, i'm binding the results of a sql query to a drop down list in a web app in the usual way.

dropdownlist.datasource= ds.tables(0)
dropdownlist.datatextfield ="org1"
dropdownlist.databind()

now what if i wanted to concatenate other fields and combine them.
specifially org1,org2,org3 & org4 together
normally in sql this is easy.

just select org1||org2||org3||org4 from org_security;


and the result would be a long string. and works fine in toad or sql+

but if i want to bind that whole string to the dropdown list, just like i did with the single value, how would i do that?
i've tried playing with the datatextfield property all sorts of ways, and nothing seems to work.
any ideas would be appreciated.
thanks again.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
What you need to do is add an 'expression column' to the table that you set
the datasource to. You then set the property 'displaymember' of the ComboBox
to the name of the expression column.

To create an expression column, simply add it to the Columns collection of
the table using the Add(...) method.

rik butcher said:
guys, i'm binding the results of a sql query to a drop down list in a web app in the usual way.

dropdownlist.datasource= ds.tables(0)
dropdownlist.datatextfield ="org1"
dropdownlist.databind()

now what if i wanted to concatenate other fields and combine them.
specifially org1,org2,org3 & org4 together
normally in sql this is easy.

just select org1||org2||org3||org4 from org_security;


and the result would be a long string. and works fine in toad or sql+

but if i want to bind that whole string to the dropdown list, just like i
did with the single value, how would i do that?
i've tried playing with the datatextfield property all sorts of ways, and nothing seems to work.
any ideas would be appreciated.
thanks again.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
Back
Top