We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I do a Custom Filter with column is Enum value?


I'm using MVC 5 + Knockoutjs.
I've a table named by ProductCategories, this one has a column named by Type (Int16). My enum define the value that column.

Now I need to create a custom column and it is necessary has a filter column, but I don't know how can I do that, because the information that show is a String (data annotation from enum) and my database has a Int16 column.

I tried to do, but doesn't work. When I perform a filter happen an exception.

{"Identifier 'TypeName' is not a parameter or variable or field of 'Sight.NoAlvo.TO.Entity.BasicForm.ProductCategory.ProductCategory'. If 'TypeName' is a property please add the FieldAlias or Storage attribute to it or declare it as a field's alias."}

My solution:

public class ProductCategory : BaseEntity
        #region .: Properties :.
        public Int64 Id { get; set; }
        public String Name { get; set; }
        public Double MinimalValue { get; set; }
        public Int16 Type { get; set; }
        public String TypeName { get
                return ((EnumCategoryType)this.Type).GetNameIdentifier();


        public ActionResult KODataSource(DataManager clsDataManager)
            BaseResult<ProductCategory> clsData = ProductCategoryBusiness.GetAll(clsDataManager);

            ResultModel result = new ResultModel();

            result.result = clsData.Result;
            result.count = clsData.Count;

            return Json(result, JsonRequestBehavior.AllowGet);

$(function () {
            window.baseView = {
                dataSource: ej.DataManager({ url: '@Url.Action("KODataSource")', adaptor: "UrlAdaptor" }),
                column: [
                          { headerText: "Ações", template: true, templateID: '#CustomCommand', width: '10%' },
                          { field: "Name", headerText: "Nome" },
                          { field: "MinimalValue", headerText: "Valor mínimo", format: "R$ {0:n}" },
                          { field: "TypeName", headerText: "Tipo de Categoria" }, ]

Thank you.

Attachment: error_3dd33906.zip

1 Reply

RU Ragavee U S Syncfusion Team July 10, 2015 10:57 AM UTC

Hi Cristiano,

We have analyzed the reported issue and also the screenshot that you have shared with us.

Based on the provided information, we have created a sample and we are sorry to let you know that we are unable to reproduce the issue mentioned at our end. The sample can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119569/ze/KoSample-635414846

Please try the sample and if you still face any difficulties, please get back to us with the below details.

1.       Screenshot of the exception
2.       Call Stack of the exception obtained
3.       Please reproduce the issue in the above provided sample.

Note: We suspect that you have shared the incorrect screenshot corresponding to the exception obtained. So please share the correct screenshot with us which will be very helpful for us to assist you accordingly.

Please get back to us if you need any further assistance.

Ragavee U S

Live Chat Icon For mobile
Up arrow icon