Accessing Columns
- 2 minutes to read
The ASPxCardView control stores its columns within the ASPxCardView.Columns collection.
Specify one of the following column characteristics to access an individual column with the CardViewColumnCollection.Item property:
- Index - The column’s index within the collection: the CollectionItem.Index property value.
- Name - The column’s unique identifier name: the WebColumnBase.Name property value.
- FieldName - The name of the column’s bound data source field: the CardViewColumn.FieldName property value.
- Caption - The column’s caption: the WebColumnBase.Caption property value.
Note
When you search for a column by column identifier, the search is prioritized as follows.
- 1) The Name property match;
- 2) The first FieldName property match;
- 3) The first Caption property match.
The following example uses different column characteristics to access columns.
// To access a column, specify its unique identifier name - the column's Name property is set to 'MyColumn1'.
CardViewColumn colMyColumn = CardView.Columns["MyColumn1"];
// To access a column, specify the name of the data source field to which the column is bound - the column's FieldName property is set to 'Department'.
CardViewColumn colDepartment = CardView.Columns["Department"];
// To access a column, specify its caption - the column's Caption property is set to 'Primary Phone'.
CardViewColumn colPhone = CardView.Columns["Primary Phone"];
// To access a column, specify its index within the Columns collection.
CardViewColumn colFirstColumn = CardView.Columns[0];
You can use the ASPxClientCardView.GetColumn, ASPxClientCardView.GetColumnByField or ASPxClientCardView.GetColumnById method to access client columns.