问题
How can I make a Repeater with multiple Itemtemplates ? And a template is choosed based on some condition ?
回答1:
You could have a nested repeater in your repeater:
http://www.worldofasp.net/tut/NestedRepeater/Repeater_within_Repeater_193.aspx
But this starts getting really tricky! I'd take a look at what you are trying to achieve and evaluate if this is the best option.
回答2:
You could always create hidden panels with different layouts in your itemtemplate. Then you could decide which one to display based on 'some condition' from your code behind. Not a very elegant solution, but the first one that sprang to mind.
来源:https://stackoverflow.com/questions/5713771/repeater-with-multiple-itemtemplate