I have an application that uses EntityDataSource in many places.
In EDS, I manually create a Where clause based on user input from TextBox's.
I would like the user to be able to enter "*" (asterisks) instead of "%" when requesting data.
Is Entity SQL or EDS easy to use for search / replace? I know that I can change the TextBox after entering the data, but when the user sees that his text has been changed from * to%, I do not think he will understand it.
I tried using the T-SQL Replace command and did something like this:
<asp:EntityDataSource ID="EDSParts" runat="server"
ConnectionString="name=TTEntities" DefaultContainerName="TTEntities"
EnableFlattening="False" EntitySetName="Parts"
OrderBy="it.ID DESC"
Where ="(CASE
WHEN (@PartNumber IS NOT NULL) THEN
it.[Number] LIKE REPLACE(@PartNumber, "*", "%")
ELSE
it.[ID] IS NOT NULL
END)">
<WhereParameters>
<asp:ControlParameter Name="PartNumber" Type="String"
ControlID="txtPartNumberQuery" PropertyName="Text" />
</WhereParameters>
</asp:EntityDataSource>
But I get the message "Server tag is not very well formed." I cannot find the equivalent "replace" function in the Entity SQL link ....
Any ideas?