Skip to main content
A newer version of this page is available. .
Tab

ASPxCardView.GetCardValues(Int32, String[]) Method

Returns the values of the specified data source fields within the specified card.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

public object GetCardValues(
    int visibleIndex,
    params string[] fieldNames
)

Parameters

Name Type Description
visibleIndex Int32

An integer value that identifies the card.

fieldNames String[]

The names of data source fields whose values within the specified card are returned.

Returns

Type Description
Object

An object which is an array of field values (if several field names are passed using the fieldNames parameter) or a direct field value (if a single field name is passed via the fieldNames parameter).

Remarks

The GetCardValues method returns the values of the specified data source fields in the specified grid card.

To work correctly, the GetCardValues method needs the grid to be data bound to its data source. If the grid isn’t bound yet, the GetCardValues method automatically performs implicit data binding of the grid.

Note

When the GetCardValues method is called during building the control hierarchy of an unbound grid control (e.g. in some cases of handling the ASPxCardView.CustomButtonInitialize event), implicit data binding initiated by the GetCardValues method resets the hierarchy. It might result in displaying no data within the grid, losing values entered by an end-user into editors within the grid, etc. To avoid this behavior, bind the grid manually when the page is being loaded - call the grid’s ASPxWebControl.DataBind method within the Page_Load event handler.

Example

This example demonstrates how to select customers who live in the specified country.

An end-user types the country into the search box and clicks Search. The button editor’s ButtonClick event is handled to call the ASPxClientCardView.PerformCallback method.

This sends a callback to the server and generates the ASPxCardView.CustomCallback event passing it the country entered by the user. The CustomCallback event is handled to select the customers who live in the specified country.

protected void ASPxCardView2_CustomCallback(object sender, ASPxCardViewCustomCallbackEventArgs e)
{
string country = e.Parameters.ToString();
ASPxCardView2.Selection.UnselectAll();
for (int i = 0; i < ASPxCardView2.VisibleCardCount; i++)
    if (ASPxCardView2.GetCardValues(i, "Country") != null)
        if (ASPxCardView2.GetCardValues(i, "Country").ToString() == country)
            ASPxCardView2.Selection.SelectCard(i);
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetCardValues(Int32, String[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also