In MVC4 Web Grid, Iam binding Web Grid from server side for efficient paging and sorting. Sorting is working fine for all columns except one column i.e the datatype of column is ENUM.

I have tried with grid.bind() samples that are present in this site but not working. please help me

有帮助吗?

解决方案

I had the same problem - it would not sort the Enums. So I simply just called the .ToString() on my enums when I added it to a list:

        private void CreateReport(int id, string name, 
          ReportType type, Relationshiplevel level, string date, string createdby,
                              string filetype, double filesize)
        {
          var newReport=new Report
            {
                Id = id,
              Name  = name,
              Reporttype = type.ToString(),
              Relationshiplevel = level.ToString(),
              CreatedDate = DateTime.Parse(date),
              CreatedBy = createdby,
              FileType = filetype,
              FileSize = filesize
            };
        _reports.Add(newReport);
       }

Works fine now

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top