[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Using ITemplate as property of a custom control

yawarady

1/24/2007 4:39:00 PM

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

3 Answers

Nathaniel Greene

1/24/2007 4:56:00 PM

0

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.

"yawarady@gmail.com" wrote:

> 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
>
>

yawarady

1/24/2007 9:23:00 PM

0

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.


On Jan 24, 6:56 pm, Nathaniel Greene
<Nathaniel.Gre...@community.nospam> wrote:
> 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.
>
>
>
> "yawar...@gmail.com" wrote:
> > 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- Hide quoted text -- Show quoted text -

Thomas Wong

1/31/2007 12:18:00 AM

0

> 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.cf...) that has an example you could
use.