I have search box which I want to return results based on TicketID. However, when trying to convert the TicketID to string to compare it against the search term string, I receive this error...
Here is my method:
public ActionResult Autocomplete(Ticket ticket, string term)
{
var searchTickets = db.Tickets
.Where(t => t.StatusID != 3 &&
Convert.ToString(t.TicketID).StartsWith(term))
.Take(10)
.Select(t => new
{
label = t.Summary
});
return Json(searchTickets, JsonRequestBehavior.AllowGet);
}
I have tried other suggestions on similar posts such as the SqlFunctions.StringConvert()
extension method, however, this throws a syntax error before the project is even built...
Any guidance will be appreciated.