2013-09-29 50 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); 
     } 

做工精細現在