How to reference the array "column" into a datalist??
Posted on 2004-08-27
Hello, new to .NET. I'm using a class to populate an array from a dataset (I know a dataset is an array, but I have to do some other stuff) and I can't figure out how to set which "column" from the array to display when I bind it to a DataList. Since my ArrayList doesn't have column names, I can't use this syntax:
# DataBinder.Eval(Container.DataItem, "column1")
And I thought I could do this:
# DataBinder.Eval(Container.DataItem, "Item")
# DataBinder.Eval(Container.DataItem, Item)
But that doesn't work either. If I do this: # Container.DataItem...it spits out the whole array, which looks like:
id, my name, my company
How do you reference a specific ordinal out of the arraylist in the datalist?
This is how I'm building my array, perhaps something is wrong here:
public void Add(DataRow dr)
_ID = IncrementID();
_RecipientName = dr["Recipient Name"].ToString();
_Company = dr["Company"].ToString();
Info.Add(string.Concat(S_ID, ", ", RecipientName, ", ", Company));
thanks in advance!!