Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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>

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...