This article is really great and awesome. This is from the topic “ASP.NET MVC 2.0 Implementation of searching in jqgrid” – ASP.NET MVC 2.0 Implementation of searching in jqgrid.
But right now I was facing searching problem when I added a field with small integer data type. The field added with data type of small integer will serve as Status.
Lets say the value one(1) is for Active and value two(2) is for Inactive.
When I type 1 or 2 from the text box it was throwing an error of
System.Data.Entity: The argument types ‘Edm.Int16’ and ‘Edm.String’ are incompatible for this operation. Near equals expression, line 6, column 12.
Thank you in advance.
I am glad that my old answer was helpful for you. I suppose you have problem near the line
In the code which I included in the answer I shown that
propertyInfo.PropertyType.FullNamehold the information about the datatype of the entity’s property. In the code I used only two types: string and 32-bit integer. In case of 32-bit integers I made the corresponding data parsing with respect ofInt32.Parse:You should replace ” ? : ” operator with
casewhere you testpropertyInfo.PropertyType.FullNamefor more data types. For example in case ofsmallintSQL type you should useSystem.Int16, in case oftinyintit should beSystem.Byte, ThesbyteSQL datatype corresponds toSystem.SByteand so on. If you would use as the second parameter ofObjectParametercorrect datatype all should work correctly