2012-04-27 7 views
1

내 컨트롤러 :변경 DevExpress의 수출 행 값

public ActionResult ExportTo(ExportFormat exportFormat = ExportFormat.Xlsx) 
    { 
     ExportType exportType = GridViewHelper.ExportTypes.SingleOrDefault(x => x.Format == exportFormat); 

     if (exportType != null) 
     { 
      var modelList= modelRepository.GetAll(); 

      var gridviewSettings = CreateExportGridViewSettings(); 
      if(gridviewSettings != null) 
       return exportType.Method(gridviewSettings, modelList); 
     } 

     return RedirectToAction("Index"); 
    } 

    ... 

    private GridViewSettings CreateExportGridViewSettings() 
    { 
     var settings = new GridViewSettings 
          { 
           Name = "Export", 
           CallbackRouteValues = new {Controller = "MyController", Action = "List"}, 
           Width = Unit.Percentage(100) 
          }; 

     settings.Columns.Add("Id", Resources.Id); 

     !!! ---- !!! 

     ... 
    } 

! ---- !!! < - 여기에 항목을 추가하고 싶습니다. 값이 True이면이 열의 행 출력은 YES이고 값이 False 인 경우 NO가되어야합니다.

답변

0
settings.Columns.Add(set => 
        { 
         set.FieldName = "IsSomething"; 
         set.Caption = "Is Something"; 
         set.UnboundType = DevExpress.Data.UnboundColumnType.String; 
         set.UnboundExpression = "Iif([IsSomething]==True, 'Yes', 'No')"; 
        });