I have a data bound listbox that lists names of items, I am now wanting to display both the item number and the Item name in something that looks like: i-001 - Item 1. I have done something similar to this, but it was when I was not using data text fields, but iDataReaders instead.
so can I append the datatextfield attribute in anyway to accept more than one column? Either in the aspx page or in the code behind?
If there is any code that can be of help I can provide it to you, if there is any clearing up that can be done I will do my best to do so.
Thank you
Sample Code:
listItems.DataSource = DAL.Util.getItemProfiles(vendor,catalog);
listItems.DataBind();
public string ItemNumName
{
get { return "CustItemNum" + " - " + "Name"; }
}
protected void listItems_DataBound(object sender, EventArgs e)
{
listItems.DataTextField = ItemNumName;
}
this cause the following error message:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'CustItemNum - Name'.
If I remove the + " - " + "Name" from the property it functions correctly by showing just the CustItemNum field