E
Emma Middlebrook
Hi there,
I've been trying to implement a repeater control in an ASP.NET 2 page
but I can't seem to get the layout exactly how I want and I'm not sure
if it's something that I am doing wrong or maybe the repeater control
doesn't have the capabilities...?
The page needs to display a custom number of sections that appear the
same but have different data..
E.g. Like a bank statement..
Label: Transactions for date ....
A table showing the transactions.
Then ideally a row at the bottom totalling the columns in the grid.
I've implemented a repeater control putting the first label in the
header, then the item template holds all the transactions. The total
row was put in the footer template..
Unfortunately, I can only see a way to have one block. This needs to
be dynamic as I'm told at display time how many blocks of transactions
I need to output onto the page...
Here's the aspx code I've come up with so far...
<asp:Repeater ID="siteSummary" runat="server"
DataSourceID="sitesDS" OnItemDataBound="ItemBound">
<HeaderTemplate>
<table width="100%">
<tr>
<asp:Label ID="itemHeader" width="100%"
BackColor="#C25E00" ForeColor="White" Text="Transactions"
runat="server"/>
</tr>
<tr>
<th>Description</th>
<th>Total</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem,
"Description").ToString()%></td>
<td><%#DataBinder.Eval(Container.DataItem,
"Total").ToString()%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td></td>
<td>Todo: total?</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Perhaps there is a better way of doing this that I am not familiar
with?
Many thanks,
Emma
I've been trying to implement a repeater control in an ASP.NET 2 page
but I can't seem to get the layout exactly how I want and I'm not sure
if it's something that I am doing wrong or maybe the repeater control
doesn't have the capabilities...?
The page needs to display a custom number of sections that appear the
same but have different data..
E.g. Like a bank statement..
Label: Transactions for date ....
A table showing the transactions.
Then ideally a row at the bottom totalling the columns in the grid.
I've implemented a repeater control putting the first label in the
header, then the item template holds all the transactions. The total
row was put in the footer template..
Unfortunately, I can only see a way to have one block. This needs to
be dynamic as I'm told at display time how many blocks of transactions
I need to output onto the page...
Here's the aspx code I've come up with so far...
<asp:Repeater ID="siteSummary" runat="server"
DataSourceID="sitesDS" OnItemDataBound="ItemBound">
<HeaderTemplate>
<table width="100%">
<tr>
<asp:Label ID="itemHeader" width="100%"
BackColor="#C25E00" ForeColor="White" Text="Transactions"
runat="server"/>
</tr>
<tr>
<th>Description</th>
<th>Total</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem,
"Description").ToString()%></td>
<td><%#DataBinder.Eval(Container.DataItem,
"Total").ToString()%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td></td>
<td>Todo: total?</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Perhaps there is a better way of doing this that I am not familiar
with?
Many thanks,
Emma