title: EntityDataSource replace * with % wildcard on queries
body: <p>I have an application that uses EntityDataSource in many places. </p>
  
  <p>In the EDS, I manually build the Where clause based on user input from TextBox'es.</p>
  
  <p>I would like the user to be able to enter "*" (asterisks) instead of "%" when querying data.</p>
  
  <p>Is there an easy as using Entity SQL or the EDS itself to do a search/replace? I know I could actually change the TextBox after the data is entered, but when the user sees his text was changed from an * to a % I don't think he will understand.</p>
  
  <p>I have tried using the T-SQL Replace command and doing something like this:</p>
  
  <pre><code>&lt;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)"&gt;
      &lt;WhereParameters&gt;
          &lt;asp:ControlParameter Name="PartNumber" Type="String"
              ControlID="txtPartNumberQuery" PropertyName="Text" /&gt;
      &lt;/WhereParameters&gt;
  &lt;/asp:EntityDataSource&gt;
  </code></pre>
  
  <p>But I get a "Server tag is not well formed" message. I can't find an equivalent "replace" function in the Entity SQL reference....</p>
  
  <p>Any ideas? </p>