1

私のコントローラー:

    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である必要があります。

4

1 に答える 1

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')";
                    });
于 2012-05-04T14:20:33.167 に答える