ComboBox DataBinding

Posted on 2012-08-15
Last Modified: 2013-02-25
I am trying to return data from a web service looks like below.  I can call the service and get data back, it comes back as a type StationInfo.  

I need to bind this to a ComboBox?

Calling the WS:
 object CISStations = getCISStations.GetCISStations(strProc);

From Web Service Interface:
<?xml version="1.0" encoding="utf-8" ?>
- <CISReturntype xmlns:xsi="" xmlns:xsd="" xmlns="">
  <description>(T) ED Inspection, LH</description>
- <Next>
  <description>(T) ED Inspection, RH</description>
- <Next>
  <description>(T) ED Offline Repair</description>
Question by:triplebd69
    LVL 16

    Expert Comment

    by:Rose Babu
    Hi, Do you know what is the return type of GetCISStations method?

    you can iterate the CISStations and add the values to the datatable (e.g., in dtCombo)

    after that assign this datatable as a datasource to the combobox. and set the datatextfield, datavaluefield then bind it.
     below is the sample bind process with sample data.
    // Sample Data
    DataTable dtCombo = new DataTable();
    DataRow drCombo;
    drCombo = dtCombo.NewRow();
    drCombo["Value"] = "44";
    drCombo["Description"] = "(T) ED Inspection, LH";
    drCombo = dtCombo.NewRow();
    drCombo["Value"] = "43";
    drCombo["Description"] = "(T) ED Inspection, RH";
    drCombo = dtCombo.NewRow();
    drCombo["Value"] = "52";
    drCombo["Description"] = "(T) ED Offline Repair";
    // Sample Data
    // Bind Data to ComboBox
    ddlEETest123.DataSource = dtCombo;
    ddlEETest123.DataTextField = "Description";
    ddlEETest123.DataValueField = "Value";

    Open in new window


    Author Comment

    I don't know what that return type is from the web service.  That is part of the problem.
    LVL 16

    Accepted Solution

    do you have the wsdl link or file? if so pls post that

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now