Problem with dropdown list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    Problem with dropdown list

    Hi all,
    I would like to select the whole items of field in a table to a dropdown list..

    For example, if i am having a table called supplier and supplier_id is one field in

    that table. i want to select everything in the field supplier_id to a dropdown list

    and display it to the user..please help me.. I am using asp.net and c#.net

    Regards,
    Mathew'
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Use a stored procedure to return the supplier_id. Save this result set into a dataset. Assign the drop down list datasource to the dataset. The drop down list datatextfield and datavaluefield will both be "supplier_i d". Then call the DataBind() method of the drop down list.

    Code:
    ddl.DataSource = ds;
    ddl.DataTextField = "supplier_id";
    ddl.DataValueField = "supplier_id";
    ddl.DataBind();
    Nathan

    Comment

    • mathewgk80
      New Member
      • Sep 2007
      • 103

      #3
      Originally posted by nateraaaa
      Use a stored procedure to return the supplier_id. Save this result set into a dataset. Assign the drop down list datasource to the dataset. The drop down list datatextfield and datavaluefield will both be "supplier_i d". Then call the DataBind() method of the drop down list.

      Code:
      ddl.DataSource = ds;
      ddl.DataTextField = "supplier_id";
      ddl.DataValueField = "supplier_id";
      ddl.DataBind();
      Nathan
      Hi,
      I am not using any gridview. i need to retirieve all the items in a particular field of a table to a dropdownlist
      Please help me....

      Regards,

      Mathew

      Comment

      Working...