Accessing DataItem in DataList

J

js

My DataList.DataSource is bound to a IDataReader. The SQL data record
contains a bit (boolean) on the 5th column that I want to translate to
"Yes" for 1 and "No" for 0. I know I can't convert the data in SQL
Case, but I'd to try the conversion in the DataList_ItemDataBound
event. However, I can not access the column using the following code.

string YesOrNo = string.Empty;
if (((DataRowView)e.Item.DataItem).Row.ItemArray[4].ToString() == "1")
YesOrNo = "Yes";
else
YesOrNo = "No";

I think the IDataReader doesn't contain a DataView, neither the
DataRowView. Does anyone know how to do this within a DataList event?
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
473,777
Messages
2,569,604
Members
45,222
Latest member
patricajohnson51

Latest Threads

Top