views:

12

answers:

1

Hi all,

Here is my problem. I need to display an html table with 9 cells in each row, how can I do it without writing every cell's html code ? I'd need something like that :

<table>
  <tr>
    <asp:repeater runat="server" datasource="[0..9]">
     <itemtemplate>
       <td><%# Eval("value") %></td>
     </itemtemplate>
    </asp:repeater>
  </tr>
</table>

Is there any built-in asp.net control ? I don't want to build some html code in my code-behind. thanks

+1  A: 

There sure is, Enumerable.Range. In your case it'll be

Enumerable.Range(1, 9)

You can then retrieve the current enumerator value like so

<%# Container.DataItem %>
R0MANARMY
How do I get the value inside the itemtemplate ?
remi bourgarel