several <ItemTemplate> in one ListView

拟墨画扇 提交于 2019-12-13 04:16:54

问题


I saw a lot of examples of using ListView,but couldn't found simple,understandable example of using two (or more) ItemTemplates in one ListView (if it possible).I want to define them on .aspx page or to make programmatically,and,depending on my needs choose one of them (different templates for different binding data).Any idea? Thanks.


回答1:


I hope this would help you achieve what you want? http://blogs.msdn.com/b/mikeormond/archive/2008/07/26/dynamically-loading-listview-templates.aspx

Also go through this post to have some insight as well http://forums.asp.net/t/1699218.aspx/1?ListView+ItemCommand+event+not+working+with+Dynamic+Templates




回答2:


You can make one <ItemTemplate>with several panels inside, and then in code beind you make only one of them visible.



来源:https://stackoverflow.com/questions/12772558/several-itemtemplate-in-one-listview

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