Can't View Item Template in Designer Viewer

D

davidr

Hi,

I creted a usercontrol which has an ITemplate in it named ItemTemplate.
I am using ASP 2.0.

When I drag the user control on to my .aspx page everything looks fine.
Once I add the
<ItemTemplate></ItemTemplate> tags the control no longer displays
inside the design viewer. I can add any asp, html or other controls in
between the <ItemTemplate></ItemTemplate> and they appear when I run
the webpage. Why do these not appear in my designer view? Also, is
there a way so I can make the <ItemTemplate> editable in the designer
view like you can with the asp:gridview. In the asp:gridview you are
able to click Edit Templates, select one and put whatever HTML you want
right there in the designer view. Then click End Editing and it goes
back to the normal control view. I am doing this with a User Control
because it saves a lot of time of trying to create my own web user
control. I know when you create a web control you have to set up the
GetDesignerHTML() in order to see it in design view, but I didn't read
about anything like that for user controls. All the Item template is a
place holder for the HTML that will be defined in the .aspx page
between <ItemTemplate></ItemTemplate>.

Also, Yes I did instantiate the ItemTemplate as shown below.

private ITemplate _itemTemplate;

[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(TemplateControl))]
public ITemplate ItemTemplate
{
get { return _itemTemplate; }
set { _itemTemplate = value; }
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

if (_itemTemplate != null)
{

_itemTemplate.InstantiateIn(this.AspPlaceHolder);

}

}

Thank you,

David
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top