Multiple fields in a DropDownList

  • Thread starter Thread starter tshad
  • Start date Start date
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
 
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...
 
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
 
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


tshad said:
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
 
Back
Top