You cannot combine two fields in DataValueField, but you can try several things.
- You can build your SQL query with concatenation (if you get data from a database)
SQL query:
Select (TeamID +"|"+ TeamTypeID) as CombinedTeam, .....`
and then install
DataFieldValue = "CombinedTeam"
or
- You can use the LINQ query to create an anonymous type based on the concatenation of two fields.
eg:
var query = from t in yourDataSource
select new
{
CombinedTeam = t.TeamID + "|" + t.TeamTypeID,
}
Then specify the data source for the LINQ dropdown and specify DataFieldValue
yourDropDownList.DataSource = query;
yourDropDownList.DataFieldValue = "CombinedTeam";
source
share