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.