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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top