I'm using this EntityDataSource in a aspx page to retrieve some data from my database:
<asp:EntityDataSource ID="mydatasource" runat="server"
ConnectionString="name=myconnectionstring"
DefaultContainerName="mydefaultcontainer"
EnableFlattening="False"
EntitySetName="Tasks"
Select="it.[ID], (it.ID + ' - ' + ISNULL(it.Name, ' ')) as [FullTaskName]" //Second argument of ISNULL is a whitespace.
Where="it.Project = @projectID" >
<WhereParameters>
<asp:ControlParameter ControlID="tbProject" Name="projectID" PropertyName="Text" Type="String" />
</WhereParameters>
</asp:EntityDataSource>
As you can see, im selecting the combination of 2 fields (ID + Name) as a single field, so i can use it in a dropdownlist.
In the Task table, the field Name can be null, and in that case the whole FullTaskName become null (or empty string, im not sure).
ID Name
0 Name0
1 NULL
2 Name2
With this data, my expected output will be like this:
0 - Name0
1 -
2 - Name2
But instead i got this:
0 - Name0
2 - Name2
- Is this the intended behaviour?
- How can i get my expected output? (I tried to use the "ISNULL(column_name, replace_with_this_string)" function, but i get an "isnull cannot be resolved into valid type or function" error.