bind a DataRow

Discussion in 'ASP .Net Web Services' started by n1patrick, Jan 5, 2007.

  1. n1patrick

    n1patrick Guest

    Hey, does anyone know how to bind a datarow generated from a Select on
    a dataset to a DDL?

    Here's the code:

    ------
    ....fill my dstItemList with sql query....

    DataRow[] drCollection;

    drCollection = dstItemList.Tables[0].Select("ItemName LIKE 'blah%'");

    ddlItemName.DataSource = drCollection;
    ddlItemName.DataTextField = "ItemName";
    ddlItemName.DataValueField = "ItemID";
    ddlItemName.DataBind();

    --------

    I thought that is all I had to do. It works with the dataset, but it
    isn't finding my datatextfield or datavaluefield with the datarow. It
    seems that the rows the Select method creates doesn't maintain the col
    names. So how do I bind it?

    Thanks
     
    n1patrick, Jan 5, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.