Nesting a repeater inside a table??

M

mj.redfox.mj

Hi

I'm fairly new to ASP.NET and realise I'm probably asking a very
straightforward question, sorry about that but I'd be grateful if
someone could possibly help out - I'm sure the answer will turn out to
be very easy!


I'm trying to basically do the following (in reality there is a lot
more code in between the table rows, such as the cells and their
contents, but I'm only posting the structure here as that's the
relavant bit):


<asp:Table>

<asp:TableRow>
</asp:TableRow>

<asp:TableRow>
</asp:TableRow>

<asp:TableRow>
</asp:TableRow>

<asp:Repeater ID="rep1" runat="server">
<ItemTemplate>
<asp:TableRow>
</asp:TableRow>
</ItemTemplate>
</asp:Repeater>

</asp:Table>


Unfortunately, the parser doesn't like the repeater being where it is
- however I definitely need to use a repeater here, as I've got some
other non-repeating stuff to include in the first few table rows (a
basic data grid with just one header row wouldn't even begin to
accommodate what I need for this). If anyone could suggest how I can
get the above code to compile I'd be very grateful!
 
M

mj.redfox.mj

I think I MAY have found the answer...I believe I need to use the
Repeater's <headertemplate> fof the non-repeating rows. Will post
again once I've tested this.
 
M

mj.redfox.mj

Hi again

A quick update...sadly that didn't work. I felt sure this would solve
my problem...


<asp:Repeater ID="rep1" runat="server">
<headertemplate>
<asp:Table>

<asp:TableRow>
</asp:TableRow>

<asp:TableRow>
</asp:TableRow>

<asp:TableRow>
</asp:TableRow>

</headertemplate>
<ItemTemplate>

<asp:TableRow>
</asp:TableRow>
</ItemTemplate>

<ItemTemplate>

<FooterTemplate>
</asp:Table>
</FooterTemplate>

</asp:Repeater>


....but I get the following error...


System.Web.UI.WebControls.TableRowCollection must have items of type
'System.Web.UI.WebControls.TableRow'. 'ItemTemplate' is of type
'System.Web.UI.HtmlControls.HtmlGenericControl'


I'll keep trying to solve this and report back with any progress!
 
M

mj.redfox.mj

Oops, ignore the last <ItemTemplate> above, I know that shouldn't be
there. Apologies.
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top