asp.netrepeateritemdatabound

Programmatically select/use ItemTemplate or AlternatingItemTemplate


I have a ASP.NET repeater, and i want to make use of it's ItemTemplate and AlternatingItemTemplate slightly different as how they are supposed to be used. Instead of having ASP.NET to switch between the 2 for every odd/even item, i want to choose the right template in the ItemDataBound event.

Does anyone know whether this is possible?

I saw that which template is being applied, comes from which ItemType the row/item has. So if anyone knows how to manipulate that value, that would be great as well.


Solution

  • Turns out that this is really not possible. The only option you have here, is to write your own version that inherits from ASP.NET repeater. Then, of course, you can do/overrule whatever you like to do with your templates.