ITemplates wrapped in extra <div> tags by .net 2.0 / MCMS

A

Andrew

Hi,

I'm trying to create a templated server control in .net 2.0 (for MCMS),
but all control's templated items are wrapped in <div> tags (which they
shouldn't be)

Any idea why this is producing extra divs? Let me know if you need more
code

Thanks.



I'm got the following code:

----- WebControl.cs -----

....

[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(Item))]
public virtual ITemplate ItemTemplate;
// get / set are defined here in my actual code

public override void DataBind()
{
CreateChildControls();
ChildControlsCreated = true;
base.DataBind();
}

protected override void CreateChildControls()
{
this.Controls.Clear();
foreach (ChannelItem channelItem in _rootChannel.Channels)
{
Item item = new Item(channelItem);
ITemplate itemTemplate = ItemTemplate;
itemCloseTemplate.InstantiateIn(item);
Controls.Add(item);
}
}

....


----- with the ASPX code -----

<ul>
<cc1:WebControl runat="server" >
<ItemTemplate><li><a href="<%# Container.Url %>"><%#
Container.Title %></a></li></ItemTemplate>
</cc1:WebControl>
</ul>


----- This outputs the following -----

<ul><div>
<li><a href="...">Item</a></li>
</div><div>
<li><a href="...">Item</a></li>
</div></ul>

----- Should be just -----

<ul>
<li><a href="...">Item</a></li>
<li><a href="...">Item</a></li>
</ul>
 

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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top