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
 
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
 
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
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top