Question

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.

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top