Using ITemplate as property of a custom control

Y

yawarady

Hi,

I am using ITemplate as property of a custom control in order to get
the following struct:

<test:mycontrol>
<myTemplate>
<asp:TextBox..........
</myTemplate>
</test:mycontrol>

The only thing that I want to add now is a property to the myTemplate
tag, in order to be able to set something like:
<myTemplate Text="testing">

Is there any way to accomplish this change?

Thanks
 
N

Nathaniel Greene

You would probably have to create a class that implements ITemplate and
create a property there. I am guessing you want the property to be linked
with the content inside of the template? That may be more difficult depending
upon what that content can actually be changed to by the user.
 
Y

yawarady

Hi,

I tried to create a class that implements ITemplate and create the
property there but I'm getting this annoying error that I can't
overcome:
Error 1 Cannot implicitly convert type
'System.Web.UI.CompiledTemplateBuilder' to
'Controls.myTemplate' c:\Inetpub\wwwroot\Builder\Default.aspx 12
As for you question, the content of the template should be any type of
one or more controls.

Thanks.
 
P

Peter Zolja

I tried to create a class that implements ITemplate and create the
property there but I'm getting this annoying error that I can't
overcome:
Error 1 Cannot implicitly convert type
'System.Web.UI.CompiledTemplateBuilder' to
'Controls.myTemplate' c:\Inetpub\wwwroot\Builder\Default.aspx 12

If you would post some code we may be able to help you out. A simple search
for implementing ITemplate returned this page
(http://www.tek-tips.com/faqs.cfm?fid=4867) that has an example you could
use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top