我正在使用 Devexpress 的 CardView,我正在像这样绑定到数据库:
var cardView = Html.DevExpress().CardView(settings =>
{
settings.Name = "MyCardView";
}
@cardView.BindToEF(string.Empty, string.Empty, (s, e) =>
{
e.QueryableSource = Helper.CustomerData();
}).GetHtml()
现在我可以通过执行以下操作将链接添加到卡片顶部:
var cardView = Html.DevExpress().CardView(settings =>
{
settings.Name = "MyCardView";
settings.CardLayoutProperties.Items.AddGroupItem(g =>
{
g.ColSpan = 1;
g.ShowCaption = DefaultBoolean.False;
g.GroupBoxDecoration = GroupBoxDecoration.None;
var cmdLayoutItem = new CardViewCommandLayoutItem();
cmdLayoutItem.HorizontalAlign = FormLayoutHorizontalAlign.Right;
var publicUrlButton = new CardViewCustomCommandButton();
publicUrlButton.ID = "Link123";
publicUrlButton.Text = "My Funny Url";
cmdLayoutItem.CustomButtons.Add(publicUrlButton);
g.Items.Add(cmdLayoutItem);
});
settings.Columns.Add(c =>
{
c.FieldName = "Id";
c.Caption = "Id";
c.ReadOnly = true;
c.Visible = false;
});
settings.Columns.Add(c =>
{
c.FieldName = "IsOpen";
c.Caption = "IsOpen";
c.ReadOnly = true;
c.Visible = false;
});
}
@cardView.BindToEF(string.Empty, string.Empty, (s, e) =>
{
e.QueryableSource = Helper.CustomerData();
}).GetHtml()
Helper.CustomerData()
返回IQueryable<CustomerData>
一个. 现在想象我的表CustomerData
有一个名为IsOpen
. 我怎样才能显示publicUrlButton
只有当值为IsOpen
真时?