XML in Repeater HeaderTemplate

tate

Centurion
Joined
Nov 10, 2003
Messages
116
Is there a way to add information from an XML file into the repeater control's HeaderTemplate? I have no problem displaying XML information in the ItemTemplate but I receive the following exception when I place data in the HeaderTemplate.

"Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: container"

~~~~~~~~~~~~~~~~~~~~~ Code ~~~~~~~~~~~~~~~~~~~~~~
<asp:Repeater id="rpSeries" DataSourceID="XmlDataSource1" runat="server">
<HeaderTemplate>
<font size="+1"><strong>Current Sermon Series:
<br /><br />
<%#XPath("Title")%>
</strong></font>
</HeaderTemplate>
<ItemTemplate>
<div class="content">
<br /><br />
<Strong><%#XPath("Date")%> <%#XPath("Sermon")%>
<br />
</Strong>
<%#XPath("Scripture")%>
<br /><br />
<%#XPath("Text")%>
<br />
</div>
</ItemTemplate>
<FooterTemplate>
 
</FooterTemplate>
</asp:Repeater>
 
Header items don't have associated data items, so you'll need to either handle the ItemDataBound event and populate the value when you're working with a header item (e.Item.ItemType = ListItemType.Header) or you'll need to call a custom method on the page to populate the vaule.
 
Back
Top