CodeSmith Community
Your Code. Your Way. Faster!

Strongly typed repeater

Latest post 03-07-2008 10:33 AM by CitizenBane. 6 replies.
  • 02-14-2008 9:31 AM

    • Rippo
    • Top 75 Contributor
    • Joined on 05-06-2005
    • UK
    • Posts 66
    • Points 1,570

    Strongly typed repeater

    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

    • Post Points: 35
  • 02-20-2008 5:15 AM In reply to

    • Rippo
    • Top 75 Contributor
    • Joined on 05-06-2005
    • UK
    • Posts 66
    • Points 1,570

    Re: Strongly typed repeater

    Bumpty bump... 

    Richard Wilde wildesoft.net

    • Post Points: 5
  • 03-06-2008 10:49 AM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Battle Creek, MI
    • Posts 95
    • Points 1,775

    Re: Strongly typed repeater

    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.

    I'm outside ur box, shiftin' ur paradigm.
    • Post Points: 35
  • 03-06-2008 11:24 AM In reply to

    • Rippo
    • Top 75 Contributor
    • Joined on 05-06-2005
    • UK
    • Posts 66
    • Points 1,570

    Re: Strongly typed repeater

    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. 

    Richard Wilde wildesoft.net

    • Post Points: 35
  • 03-06-2008 2:51 PM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Battle Creek, MI
    • Posts 95
    • Points 1,775

    Re: Strongly typed repeater

    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'm outside ur box, shiftin' ur paradigm.
    • Post Points: 5
  • 03-06-2008 3:11 PM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Battle Creek, MI
    • Posts 95
    • Points 1,775

    Re: Strongly typed repeater

    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'm outside ur box, shiftin' ur paradigm.
    • Post Points: 5
  • 03-07-2008 10:33 AM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Battle Creek, MI
    • Posts 95
    • Points 1,775

    Re: Strongly typed repeater

    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.

    I'm outside ur box, shiftin' ur paradigm.
    • Post Points: 5
Page 1 of 1 (7 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems