Patrick
Patrick

Reputation: 5592

C# Design template containers?

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.

Upvotes: 2

Views: 629

Answers (1)

Mark Redman
Mark Redman

Reputation: 24515

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?

Upvotes: 2

Related Questions