2013-09-29 55 views
0

在MVC4 Web Grid中,Iam从服务器端绑定Web网格以进行高效的分页和排序。 对于除一列以外的所有列,排序工作正常,即列的数据类型为ENUM。asp.net mvc 4 webgrid枚举数据类型列的排序问题

我尝试过使用grid.bind()样本,这些样本存在于本网站但未能正常工作。 请帮我

+0

的WebGrid排序枚举数据类型列的问题 – amshekar

回答

0

我有同样的问题 - 它不会排序枚举。所以,我只是简单地叫的ToString()在我的枚举当我把它添加到列表:

 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); 
     } 

做工精细现在