I have ListView with paging and EntityDataSource. ListView should show all items from database but If in url we have for example phrase 'cat' it should show only items with phrase 'cat' in Title so I have:
public partial class List : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["phrase"] != null)
{
EntityDataSource1.WhereParameters.Add("Phrase", TypeCode.String, Request.QueryString["phrase"].ToString());
EntityDataSource1.Where = "it.Title like '%' + @Phrase + '%'";
}
}
}
But when I go to next page I have error: Parameter name "Phrase" already exists in the parameter collection
What can I do?