Pregunta

Estoy usando la vista de lista para mostrar mis datos. En el caso ItemDataBound que quiero hacer alguna manipulación y cambiar algunos de los datos que se muestran. Cuando compruebo el artículo en este caso estoy usando el siguiente código, pero necesito saber si el artículo es un artículo alterna ya que esto afectará a lo que yo quiero hacer con la fila. ¿Puede alguien me punto en la dirección correcta?

if (e.Item.ItemType == ListViewItemType.DataItem)
{
   ListViewDataItem currentItem = (ListViewDataItem)e.Item;
   DataKey currentDataKey = myLilstView.DataKeys[currentItem.DataItemIndex];

   //Do something   
}
¿Fue útil?

Solución

ver si esto funciona:

int currentIndex = currentItem.DisplayIndex;
if (currentIndex % 2 == 1)
{
    // alternating item
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top