Complex Templated Custom Control

mark007

Centurion
Joined
Jan 22, 2005
Messages
185
Location
York, UK
I've been working on a custom templated web control and wondering if it woukd be possible to create a complex control whereby one template provides the field for another. For example:

<asp:controlname>
<Template1>
<div><%# Container.Template2Data %></div>
</Template1>
<Template2>
<b><%# Container.Item %></b>
</Template2>
</asp:controlname>

So template 1 is used multiple times with some source data and then the items genarated from this are placed in the Template2Data fields in the first template.

Is this possible?

:)
 
Just a follow up - I've still not worked out if this is possible but I'm thinking it's probably not - I can't think of a way of doing it really unless I could get the HTML out of the evaluated template..

(Some may have noticed the typo in the above - it should clearly say:

So template 2 is used multiple times....)

In the end I built my own template control by parsing my own templates where all the fields looked like:

[DataItem]

Works fine as I'm pullign the templates from a DB but obviously I couldn't use it as with a standard tmeplated control by typing the HTML into the page.

:)
 
Back
Top