How to: Focus a Card Which is not Displayed on the Current Page

This example shows how to focus a card which isn't displayed on the current page. To do this, you should first switch to the page which contains the required card, and then move the card focus.

protected void Button1_Click(object sender, EventArgs e)
{
    // Obtain the visible index of the required card.
    int cardIndex = ASPxCardView1.FindVisibleIndexByKeyValue("OLDWO");
    if (cardIndex == ASPxCardView.InvalidCardIndex) return;
    if (!IsCardVisibleOnScreen(cardIndex))
    {
        // Switch to the page which contains the required card.
        GoToPage(cardIndex);
    }
    // Focus the required card.
    ASPxCardView1.FocusedCardIndex = cardIndex;
}

bool IsCardVisibleOnScreen(int cardIndex)
{
    int startIndex = ASPxCardView1.PageIndex * ASPxCardView1.SettingsPager.PageSize;
    int endIndex = startIndex + ASPxCardView1.SettingsPager.PageSize;
    return cardIndex >= startIndex && cardIndex < endIndex;
}
void GoToPage(int cardIndex)
{
    ASPxCardView1.PageIndex = cardIndex / ASPxCardView1.SettingsPager.PageSize;
}