Has anyone else having troubles with strong typed repeaters and the way the HTML code is outputted
for example
<table class="table"><data:allrepositoryrepeater id="RepList" runat="server" enableviewstate="false" datasourceid="ds1"> <itemtemplate> <tr class="odd"> <td><%#Container.Title %></td> </tr> </itemtemplate></data:allrepositoryrepeater></table>
outputs
<table class="table"><span id="ctl00_MainContentPlaceHolder_RepList"> <tr class="odd"> <td>Test</td> </tr> <tr class="odd"> <td>Test2</td> </tr> </span></table>As you can see a weird span is inserted? Is this a know bug or does strongly type repeaters not support HTML tables?
Richard Wilde wildesoft.net
Bumpty bump...
I think this is because the strongly typed repeater controls inherit from System.Web.UI.Design.ControlDesigner. This is by design, I believe, as someone may not necessarily want to use a table to output their data.
If you want to use a table, you could add the appropriate table tags to the HeaderTemplate and FooterTemplate.
The header and footer templates do not output anything and are completely ignored! The span attribute is ouputed regardless. This used to work fine a few months ago on old templates but obviously a change to the templates has caused this problem.
This leaves the repeater useless for tabular data.
You are correct, and I have egg on my face.Sounds like a serious bug here.... I'm debugging through the code, and it seems to add the controls... but I'm no expert with the ComponsiteDataBoundControl...
I was able to "fix" this by moving the code that adds the Header and Footer as controls from the CreateChildControls() method to the CreateChildControls(IEnumerable datasource, bool databinding) method (before and after the foeach) in the respective EntityRepeater classes.
This, however, caused a <span> tag to surround the <table> tags.....
I'm going to look in to this some more and get back with you.
I've posted a patch that fixes this here:
http://community.codesmithtools.com/forums/p/8181/30188.aspx#30188
Let me know if this works for you... I'm not sure if this will break other things.