Can I have multiple values in a DataValueField?

Viewed 11340

Is it possible to put multiple values in a DataValueField?

For example, with the following code:

<asp:DropDownList ID="ixTeam" CssClass="ixTeam" runat="server" DataSourceID="dsixTeam" 
 DataValueField="TeamID" DataTextField="TeamName" AppendDataBoundItems="true">

Is it possible for me to put two values (e.g. TeamID + "|" + TeamTypeID) into the DataValueField?

4 Answers
SELECT  CAST(TeamID AS VARCHAR(100)) + ' | ' + CAST(TeamTypeID AS VARCHAR(100)) as CombinedColumn, TeamID ,TeamTypeID FROM [tblName]

This works for me, rest are giving conversion to int errors.

Related