BootstrapCardViewBuilderBase<T>.Bind(Object) Method
In This Article
Binds the control to the specified data source.
Namespace: DevExpress.AspNetCore.Bootstrap
Assembly: DevExpress.AspNetCore.Bootstrap.v18.2.dll
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
data |
Object | An object representing the control’s data source. |
#Returns
Type | Description |
---|---|
T | A reference to this instance after the operation is completed. |
#Remarks
IMPORTANT
Bootstrap Controls for ASP.
Follow the steps below to display data within the Card View control.
- Get the data collection you want to display on Controller side. The sample below demonstrates the Northwind database’s entity context.
- Define the CardView control in a View.
- Create a column for each data field whose data you want to display.
- Call the Bind method with the data source object as a parameter.
The following code demonstrates this approach:
cshtml
@model IEnumerable
@(Html.DevExpress()
.BootstrapCardView<SalesProduct>("cardView")
.KeyFieldName(m => m.ProductID)
.Columns(columns => {
columns.Add(m => m.ProductName);
columns.Add(m => m.UnitPrice);
columns.Add(m => m.UnitsOnOrder);
columns.AddTextColumn()
.FieldName("Total")
.UnboundType(UnboundColumnType.Decimal)
.UnboundExpression("UnitsOnOrder * UnitPrice")
.PropertiesTextEdit(properties => properties
.DisplayFormatString("c"));
})
.Routes(routes => routes
.MapRoute(r => r
.Action("Binding")
.Controller("cardView")))
.Bind(Model))
See also the Binding online demo.
See Also