ASPxCardView.InvalidCardIndex Field
Contains a value that is an invalid card index. This value is returned when an attempt to obtain a particular card fails, etc.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v19.1.dll
Declaration
Field Value
Type |
---|
Int32 |
Example
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;
}
See Also