Is it possible to filter view records via a search for a int? It words but a string but when I try any adapt it to draw all records that match an int I get error: DbComparisonExpression requires arguments with comparable types. in reference to the return view.
Controller:
public ActionResult Index(string sortOrder,string search)
{
ViewBag.TimeSortParam = String.IsNullOrEmpty(sortOrder) ? "Time_desc" : "";
ViewBag.PrioritySortParam = sortOrder == "Priority" ? "Priority_desc" : "";
var incidents = from s in db.Incidents.Include(i => i.Defect).Include(i => i.Operator)
select s;
if (!String.IsNullOrEmpty(search))
{
incidents = incidents.Where(s => s.IncidentID.Equals(search));
}
return View(incidents.ToList());
View
Find by id: @Html.TextBox("Search")
I can see the problem is I am using a string for but I cant find a solution for int
Incident.IncidentID
? – Ant P Feb 28 '14 at 22:30