Very Weird Repeater Problem

  • Thread starter Thread starter Hong
  • Start date Start date
H

Hong

Hi,

I have been scratching my head over this problem for hours, the repeater
control I am using would only render the controls specified in
HeaderTemplate and FooterTemplate, but the repeater will not render the
controls in ItemTemplate and AlternateItemTemplate.

ItemDataBound event is fired appropriately, just the rendering seems to
be messed up. The real funny part about this problem, is that it happens
only on a specific website of an IIS installation. Why does the repeater
control refuse to render itself? Are there any specific situations where
a repeater will not render itself properly? No error, no warning,
nothing...the HTML is just not there.

I'm shooting in complete darkness here...

Hong
 
Hi,

I have been scratching my head over this problem for hours, the repeater
control I am using would only render the controls specified in
HeaderTemplate and FooterTemplate, but the repeater will not render the
controls in ItemTemplate and AlternateItemTemplate.

ItemDataBound event is fired appropriately, just the rendering seems to
be messed up. The real funny part about this problem, is that it happens
only on a specific website of an IIS installation. Why does the repeater
control refuse to render itself? Are there any specific situations where
a repeater will not render itself properly? No error, no warning,
nothing...the HTML is just not there.

I'm shooting in complete darkness here...

Hong

Hi Hong,

I believe that you are not calling the Databind method of repeater.

Please check if the method is being called properly.
Otherwise the problem could be that the collection you are binding it
is empty.

thanks,
santiago
 
Hi psycho,

I just did away with the repeater and used datalist instead. I think I
know why, I wrote the repeater as such:

<asp:Repeater ID="rptrStuffs" runat="server">
<asp:HeaderTemplate>
<table>
<thead>
<th>...
</th>
</thead>
<tbody>
</asp:HeaderTemplate>
<asp:ItemTemplate>
<tr>s...
</asp:ItemTemplate>
<asp:AlternatingItemTemplate>
<tr>s...
</asp:AlternatingItemTemplate>
<asp:FooterTemplate>
</tbody>
</table>
</asp:FooterTemplate>
</asp:Repeater>

Notice that table and tbody tags are split across different templates
inside the repeater. I think this chokes the internal rendering logic of
repeater somewhere deep down Microsoft's implementation, under very
special conditions that I have no idea about.

I used datalist with ExtractTemplateRows and that solved the problem
nicely while achieving what I tried to do with the repeater.

Oh, the datasource was not empty, the databind method of repeater was
called. I checked those during the few hours of scratching my head ;)

Hong
 
Back
Top