bind a DataRow

N

n1patrick

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,049
Members
48,769
Latest member
Clifft

Latest Threads

Top