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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling Dropdownlist box from WebService dataset help?

Status
Not open for further replies.

Ddraig

MIS
Jul 16, 2004
97
US
Howdy,

I've got a dataset that contains two tables. An ID and Name that is being passed through a xml web service that I would like to put into a dropdownlist box. I need to set a text value of the Name to display and the ID as the value member. I was wondering if anyone had any ideas, I've tried a few things that I can't seem to get to work. Was wondering if anyone knew of any good FAQs or sites that they would be willing to share with me.

Thanks,
Dd.
 
If you have the data set you should be able to set the combo box's datasource equal to the data table you want from that data set. Then set the combobox's display member to the name of the datacolumn in the data table that you want to display and the combobox's value member to the name of the data coloumn in the data table that you want to get the value of.

Code:
    Me.cmbManufacturers.DataSource = dtManufacturers
    Me.cmbManufacturers.DisplayMember = "Manufacturer"
    Me.cmbManufacturers.ValueMember = "Code"

If you don't have a data set, then you just have to build your self a data table, retreive the information and add it to a data table and then do the above code.

-Rick

----------------------
 
I guess I should clarify a bit, I'm doing ASP.Net so I have a dropdownlist and I'm pulling a Dataset out of a webserivce. I've tried to set my DataSource, DataMembers, DataTextField, and DataValueFields, then Databind but nothing seems to get it to populate the box.

I'll keep fiddling with it. :)
 
Ahh when I posted this I couldn't find the ASP.net forum. Silly Me :) I'll go post their.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top