Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop Down box's 1

Status
Not open for further replies.

Junior1544

Technical User
Apr 20, 2001
1,267
US
I was wondering. I havn't seen any thing on this. Can I have a two or three colum drop down box??

I need to be able to tell the difference between different company's including different locations of the same company...

I was hoping to be able to have colum one as the company name, and colum two as the address, or city/state or some thing like that...

Any idea's??

Thanks.
--Jamse
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Here is a MultiColumn DropDown example (VB):

Sub Page_Load(Sender As Object, e As EventArgs)

If Not Page.IsPostBack Then
Dim myConnection As SqlConnection = new SqlConnection _
("server=999.999.9.9;uid=user;pwd=password;database=nexample")

Dim myCommand As SqlCommand = new SqlCommand ("select BodyIndexID, BodyIndex As IDAndName from tblBodyIndex", myConnection)

Dim myDataReader As SqlDataReader

Try
myConnection.Open()
myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

While myDataReader.Read()
Dim myListItem As ListItem = New ListItem()
myListItem.Text = myDataReader.GetInt32(0).ToString() & ", " & myDataReader.GetString(1)
myListItem.Value = myDataReader.GetInt32(0)
DropDownList1.Items.Add(myListItem)
End While

Catch myException As Exception
Response.Write("An error has occurred: " & myException.ToString())

Finally
If Not myDataReader is Nothing Then
myDataReader.Close()
End If

End Try
End If

End Sub
</script>

<body>
<form runat=&quot;server&quot;>
<asp:DropDownList id=&quot;DropDownList1&quot; runat=&quot;server&quot; />
</form>
</body>
 
I see how your doing it... Putting a , between the value's...

That does solve my problem... and it's not a bad looking solution... Thank you...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top