Skip to main content

CardViewSettings.SetCardTemplateContent(String) Method

Allows you to specify a card template.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public void SetCardTemplateContent(
    string content
)

Parameters

Name Type Description
content String

A string value specifying the template content.

Remarks

@Html.DevExpress().CardView(
    settings =>
    {
        settings.Name = "CardView";
        ...
        settings.SetCardTemplateContent(c => {
            Html.DevExpress().BinaryImage(s => {
                s.Name = "Image" + DataBinder.Eval(c.DataItem, "EmployeeID");
            }).Bind(DataBinder.Eval(c.DataItem, "Photo"))
            .Render();
            ViewContext.Writer.Write(
                "<div class='info'>" +
                    "<p>" + DataBinder.Eval(c.DataItem, "FirstName") + " " + DataBinder.Eval(c.DataItem, "LastName") + "</p>" +
                    "<span>" + DataBinder.Eval(c.DataItem, "Title") + "</span>" +
                    "<div class='address'>" +
                        "<span>" + DataBinder.Eval(c.DataItem, "Country") + " " + DataBinder.Eval(c.DataItem, "City") + "</span>" +
                        "<br />" +
                        "<span>" + DataBinder.Eval(c.DataItem, "Address") + "</span>" +
                    "</div>" +
                "</div>"
            );
        });
}).Bind(Model).GetHtml()

Card Template

Run Demo: CardView - Templates

See Also