I have an Input and a datatable, when the user type in that input I filter data on KeyUp depending on what the user typed in. just like datatables.net but it is from scratch for learning.
The datatable has 3 columns fullname (string), city (string) and dateofbirth (datetime).
I want if the user type for example: "2/" it will give him all the DOB's that has 2/ in them. so far this is my code (I tried many but none worked).
var data = _context.Person.Where(p => p.DateOfBirth.Value
.ToString("d").Split()[0].Contains(SearchQuery)).ToList();
// Split() to remove the time part.
And:
var data = _context.Person.Where(p => p.DateOfBirth.Value
.ToString().Contains(SearchQuery)).ToList();
But both giving me an exception: 'Translation of method System.DateTime.ToString' failed