views:

272

answers:

1

Hi,

I'm trying to extend a custom repeater I have in order to display in a tabular fashion (reasonably similar to a Gridview). What I'm conceptually looking to achieve is to get to something that can be applied in the following way:

<my:customrepeater id="rpt" runat="server">
    <cols>
        <col Header="ID">##ID##</col>
        <col Header="Name">##Name##</col>
    </cols>
</my:customrepeater>

Can anyone suggest a way this can be achieved? Can I somehow create a collection for a class that implements ITemplate?

Thanks, Steve

!EDIT!

I've achieved it by creating a new class (Col) with a ITemplate property and then a generic.list(of Col) property in the repeater. So to add items I do the following:

  <Columns>
     <my:Col Header="1"><ColTemplate>test</ColTemplate></my:Col>
     <my:Col Header="2"><ColTemplate>test2</ColTemplate></my:Col>
     <my:Col Header="3"><ColTemplate>test3</ColTemplate></my:Col>
  </Columns>

Let me know if anyone has any better solutions

+1  A: 

I've achieved it by creating a new class (Col) with a ITemplate property and then a generic.list(of Col) property in the repeater. So to add items I do the following:

<Columns>
    <my:Col Header="1"><ColTemplate>test</ColTemplate></my:Col>
    <my:Col Header="2"><ColTemplate>test2</ColTemplate></my:Col>
    <my:Col Header="3"><ColTemplate>test3</ColTemplate></my:Col>
</Columns>

Seeing as no other recommendations came in I thought I should mark this as answered and provide my solution here.

Cheers

stibstibstib