Using ITemplate as property of a custom control

Discussion in 'ASP .Net Building Controls' started by yawarady@gmail.com, Jan 24, 2007.

  1. Guest

    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
     
    , Jan 24, 2007
    #1
    1. Advertising

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

    "" 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
    >
    >
     
    Nathaniel Greene, Jan 24, 2007
    #2
    1. Advertising

  3. Guest

    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
    <> 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.
    >
    >
    >
    > "" 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 -
     
    , Jan 24, 2007
    #3
  4. Peter Zolja Guest

    > 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.
     
    Peter Zolja, Jan 31, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luhar Powell via .NET 247
    Replies:
    0
    Views:
    2,452
    Luhar Powell via .NET 247
    Apr 1, 2005
  2. LaptopHeaven
    Replies:
    0
    Views:
    411
    LaptopHeaven
    Oct 5, 2006
  3. Luhar Powell via .NET 247

    Newbie:Access custom Itemplate(not datagrid/repeater/datalist) control values on postback

    Luhar Powell via .NET 247, Apr 1, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    220
    Luhar Powell via .NET 247
    Apr 1, 2005
  4. Eli Gassert
    Replies:
    0
    Views:
    236
    Eli Gassert
    Jun 11, 2004
  5. Luhar Powell via .NET 247
    Replies:
    0
    Views:
    168
    Luhar Powell via .NET 247
    Apr 1, 2005
Loading...

Share This Page