I have a textbox bind to an int
. There is a Search button which gives result on the basis of text in textbox. If the text is 12, all results having 12 should appear.
Such being the case for string
, I would have used string.contains. But I don't know what to do in case of int
.
I am using LINQ to filter out results.
int securityId = Convert.int32(filterColumn.Value, CultureInfo.CurrentCulture);
queryResults=queryResults.Where(generaldata=>generaldata.SecuritiesId.Equals(securityId));
But this isn't working. I tried following
string securityId = Convert.ToString(filterColumn.Value, CultureInfo.CurrentCulture);
queryResults=queryResults.Where(generaldata=>generaldata.SecuritiesId.ToString().Contains(securityId));
But getting LINQ exception that I can't use ToString in expression.