In the code-behind I want to apply a dynamic where clause for the entitydatasource, but I want this where to be like and not equal. I have this code working which is equal I want an equivalence code that somehow translates this into a Like statement.
EntityDataSource1.WhereParameters.Add("Name", TypeCode.String, tbxSearch.Text);
Solution after reading Jupaol comment :
Xaml:
<WhereParameters>
<asp:ControlParameter ControlID="tbxSearch" Name="Name" Type="String" />
</WhereParameters>
Code Behind: (on load event)
if (string.IsNullOrEmpty(tbxSearch.Text))
{
this.EntityDataSource1.Where = "1=1"; //fetch all data if empty
}
else
{
this.EntityDataSource1.Where = "it.Name like '%' + @Name + '%'"; //filter
}