If you can't find a way of doing it with the templates you can always do it by adding a databinding to a property which returns different data depending on whether it's called for the first time or not. Something like:
.... <div class='normalclass <%#MyFlag ? String.Empty : "my_extra_class" %>'>...
protected bool MyFlag
bool oldFlag = _myFlag; // private field
_myFlag = true; // Flag that it's been hit
return oldFlag; // Returns false first time, then true for all additional times
It's probably a good thing to reset the flag in the OnDataBinding event or similar so you know it's state when databinding starts.
You could also check the Container.ItemIndex.
I am using a PageTree to display a submenu. I want to apply a class to the first item at the top level (i.e. the first item in the TopTemplate).
Can anyone advise me on how to achieve this?