Home All Groups Group Topic Archive Search About

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

Author
19 Jun 2006 4:47 PM
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>