简体   繁体   English

如何在非主题的DevExpress GridView中为复选框提供图像?

[英]How to provide images for checkbox in an unthemed DevExpress GridView?

I turned DevExpress Themes off for DevExpress GridView, does anybody know how to provide images for checked unchecked? 我关闭了DevExpress GridView的DevExpress主题,有人知道如何为未选中的对象提供图像吗?

var grid = Html.DevExpress().GridView( settings => {
    settings.EnableTheming = false;
    settings.Columns.Add("isGrant", "Grant", MVCxGridViewColumnType.CheckBox);
}

When theming is on, I get nice check boxes in the grid, when it is off, there is no indication of any check marks, when "isGrant" is true. 启用主题设置后,我会在网格中看到漂亮的复选框;当禁用主题设置时,如果“ isGrant”为true,则没有任何复选标记。 Does anybody know how to show an image when true, and a different image when false when themes are off? 谁知道当主题关闭时如何显示图像,而当主题为假时如何显示其他图像?

Solved my own problem ... what I did was modify the VIEW and included this property: 解决了我自己的问题...我所做的是修改了VIEW并包含了以下属性:

public string GrantCheck {
    get {
        return isGrant ? "<img src='/Theme/css/images/checkmark.png'>" : " ";
    }
}   

Then in the gridview added a column with: 然后在gridview中添加一列:

settings.Columns.Add(column => {
    column.ColumnType = MVCxGridViewColumnType.TextBox;
    column.FieldName = "GrantCheck";
    column.Caption = "Grant";
    column.PropertiesEdit.EncodeHtml = false;
    column.CellStyle.CssClass = "dxcheckbox";
}); 

This way I get a nice check box. 这样,我得到一个不错的复选框。 The css class is defined as: css类的定义为:

.dxcheckbox { text-align: center;}

Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM