Reputation:
I'm facing errors about concatenation of 2 fields with different types within EntityDataSource control.
I've got a dropdownList filled by a EntityDataSource, this ddl displays the Id of each items and I have to modify it to display the concatenation of id + description.
below first definition of the ddl :
<asp:DropDownList ID="ddlScenarioID" runat="server" AutoPostBack="false"
DataSourceID="edsScenarioID" DataTextField="ScenarioID "
DataValueField="ScenarioID" Height="25px" Width="200px" EnableViewState="true"
onselectedindexchanged="ddlScenarioID_SelectedIndexChanged"
onchange="return ScenarioOnSelectedIndexChange();">
</asp:DropDownList>
and of the entitydatasource :
<asp:EntityDataSource ID="edsScenarioID" runat="server"
ConnectionString="name=StressTestEntities"
DefaultContainerName="StressTestEntities" EnableFlattening="False"
EntitySetName="Scenarios"
ContextTypeName="BDTTWebConsole.Models.EF.StressTestEntities"
Select="it.[ScenarioID]" OrderBy="it.[ScenarioID] ASC">
</asp:EntityDataSource>
I've tried to add as new DisplayText property as the concatenation of ScenarioId and Description, but it's not working. I've got a error message (see the title of my post )
this the modified code of the entitydatasource
<asp:EntityDataSource ID="edsScenarioID" runat="server"
ConnectionString="name=StressTestEntities"
DefaultContainerName="StressTestEntities" EnableFlattening="False"
EntitySetName="Scenarios"
ContextTypeName="BDTTWebConsole.Models.EF.StressTestEntities"
Select="it.[ScenarioID], it.[ScenarioID]+it.[Description] AS DisplayText " OrderBy="it. [ScenarioID] ASC">
</asp:EntityDataSource>
Can somebody help me about this? I'm newbie on c# and .net.
thank you
Upvotes: 0
Views: 2066