Concatenate Two Fields to Display in Dropdown List
Posted
by Locke12
on Stack Overflow
See other posts from Stack Overflow
or by Locke12
Published on 2010-05-26T20:29:41Z
Indexed on
2010/05/26
20:31 UTC
Read the original article
Hit count: 227
c#
|dropdownlist
Hi,
I am trying to concatenate two fields from a list to display in a dropdown. Below is the code i am trying to use. I don't want to change the model of my products so I was trying to do something like that below but I can't figure anything out without building out my own object with the fields concatenated.
skuDropDown.DataSource = List<product>
skuDropDown.DataTextField = "ProductId" // want to combine with"Description";
skuDropDown.DataValueField = "ProductId";
skuDropDown.DataBind();
Thanks any ideas will help.
© Stack Overflow or respective owner