C# 设计模板容器?
我一直在努力寻找一个好的指南来创建模板化控件。我试图在网站的几个不同部分显示一些图片,因此我想添加一个模板控件以允许我在渲染之前修改 HTML。比如:
<cc1:photos runat="server" id="myPhotos">
<photoCell>
<img src="<%# photo %>" alt="<%# alt %>" /><br /><%# photoText %>
</photoCell>
</cc1:photos>
然后我希望能够打印 photoCell ax 次数,具体取决于我想要显示的照片数量。问题是我找不到关于该主题的任何教程,该教程还显示如何使用不同的文本/图像多次打印数据。
I have been trying to find a good guide to create a templated control. I am trying to display a few pictures on several different parts of my website so I wanted to add a template control to allow me to modify the HTML before it renders. Something like:
<cc1:photos runat="server" id="myPhotos">
<photoCell>
<img src="<%# photo %>" alt="<%# alt %>" /><br /><%# photoText %>
</photoCell>
</cc1:photos>
I then want to be able to print that photoCell a x number of times depending on how many photos that I want to display. The problem is that I can't find any tutorials on this topic that also displays how to print the data several times with different texts/images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下这个来创建模板化控件:
http://msdn.microsoft .com/en-us/library/ms178657.aspx
您还考虑过使用中继器吗?
Have a look at this to create a templated control:
http://msdn.microsoft.com/en-us/library/ms178657.aspx
Also have you considered using a repeater?