<p>I'm using the ListView control (ASP.NET 2008) to show a bunch of lines of data, and at the bottom I want some totals. I was initially going to define the header and footer in the LayoutTemplate and get the totals with some local function, i.e. &lt;%#GetTheSum()%>, but it appears that the LayoutTemplate does not process the &lt;%#...%> syntax.</p>

<p>Another thought would be to put a Label in the LayoutTemplate and use FindControl to update it. Not sure if that's possible (will try shortly).</p>

<p>What's the best way to show totals using a ListView?</p>

<p>UPDATE: Solution <a href="https://stackoverflow.com/questions/212048/displaying-totals-in-the-listview-layouttemplate#212308">here</a>.</p>

Use a literal and set the variable in the code-behind.
```
```
<asp:Literal ID="litTotal" runat="server" />
```
```
code-behind:
```
```
litTotal.Text = GetTheSum();
```
```