Update:
row is null
if (e.Item.ItemType == ListItemType.Footer)
{
Label lblDateCreated = e.Item.FindControl("lblDateCreated ") as Label;
DataRowView row = (DataRowView)e.Item.DataItem; //row is null here <<<<
lblDateCreated .Text = row["DateChecked"].ToString();
}
END UPDATE:
how to show data in repeater footer?…
its very silly that i have spent good amount of time figuring out but if i move the same to itemtemplate then its showing but not in footer…below is my code..
<asp:Repeater ID="rpt" runat="server">
<HeaderTemplate>
header...
</HeaderTemplate>
<ItemTemplate>
<div class="rpt">
<div class="inner">
<div>
<div class="ert">
<%#DataBinder.Eval(Container.DataItem, "Comment")%>
</div>
</div>
</div>
</div>
<br />
</ItemTemplate>
<FooterTemplate>
footer.....
<div id="datetime">
<asp:Label ID="lblDateTime" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DateChecked")%>'></asp:Label>
</div>
<div id="save">
<p>
<asp:HyperLink ID="Hyperlink2" runat="server" NavigateUrl="~/link.aspx"
Text="More"></asp:HyperLink></p>
</div>
</FooterTemplate>
</asp:Repeater>
code-behind:
rpt.DataSource = mydatasource;
rpt.DataBind();
FooterTemplate is not rendered with each row , thus you cannot bind Comment of a DateItem to footer like this.
It seems that there would be only one Date Checked that you want to show in the footer.
You are looking DateChecked in DataItem that could be different for each row.
If all rows contain same DateChecked you can create a server side property to store it , you can use any rows Datechecked if all are same if not , you can store whichever date you want to show in footer (it should be any one date)
Use following block in footer to show the DateChecked
<% = PropertyName %>
OR
As you already placed Label in footer, you can directly bind lblDateTime from server side using this property.
To Bind Repeater in Footer Control
ASPX
CS
To Bind Repeater in Footer Control