Deleting graphics from a feature layer programmatically

Discussion created by Marvin_84 on May 4, 2012
Latest reply on Apr 2, 2013 by izambakci
I was trying to delete some graphics from my feature layer depending of one attribute, however when I loop on the graphics collection it says that have zero elements.

for (int i = flCalificacion.Graphics.Count - 1; i >= 0; i--)
   grafico = flCalificacion.Graphics[i]; //tomar el elemento gràfico

   if (derroterosBorrar.Contains(grafico.Attributes["ASIENTO"].ToString())) //si tiene el mismo nùmero de presentaciòn
           flCalificacion.Graphics.Remove(grafico); //eliminarlo
   }//fin if
}//fin for


I'm using the feature layer in Ondemand mode, should I use another one?, or there is another way to get the graphics collection from my feature layer to loop and delete it?.
Any help will be appreciated