Repeater with multiple Itemtemplate

白昼怎懂夜的黑 提交于 2019-12-25 02:26:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!