Multiple fields in a DropDownList


T

tshad

Is there a way to do something like:

UserList.DataSource=theDataSet
if ShowUserRoles.Checked then
UserList.DataTextField= "NameUserName" & " / " & "RoleDescription"
else
UserList.DataTextField= "NameUserName"
end if
UserList.DataValueField="UserID"
UserList.databind()

I could assign a variable to the Select statement that does it, but I would
prefer to do it here, if possible.

Thanks,

Tom
 
Ad

Advertisements

S

Steve C. Orr [MVP, MCSD]

There's no good way to adjust the data once it's in the DropDownList.
Therefore you should make the change in the underlying DataSet before you
bind it to the DropDownList. It might be easiest to do this in your initial
Select statement...
 
T

tshad

Steve C. Orr said:
There's no good way to adjust the data once it's in the DropDownList.
Therefore you should make the change in the underlying DataSet before you
bind it to the DropDownList. It might be easiest to do this in your
initial Select statement...

That was what I figured.

Thanks,

Tom
 
Ad

Advertisements

P

Patrick.O.Ige

As steve adviced just trying doing e.g
strSQLQuery = "SELECT id, " _
& "RTRIM(email) + ' ' + RTRIM(lastname) AS name " _
& "FROM contacts ORDER BY id;"
Hope that helps
Patrick
 

Top