bind a DataRow

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

  1. 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
    , Jan 5, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mr2_93
    Replies:
    1
    Views:
    3,593
    mr2_93
    Oct 2, 2005
  2. RSH
    Replies:
    2
    Views:
    2,261
  3. wardemon
    Replies:
    0
    Views:
    965
    wardemon
    Nov 30, 2006
  4. Replies:
    0
    Views:
    590
  5. HelpPlease

    Datarow can't bind to datagrid...I need a workaround

    HelpPlease, Feb 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    721
    Marshal Antony
    Feb 12, 2004
Loading...

Share This Page