Pergunta

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

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top