I guys, isn't present databound event on asp repeater server control?
I just want to bind all my data, and at the end creates a new ItemTemplate and add it, but just when is all data binded
I guys, isn't present databound event on asp repeater server control?
I just want to bind all my data, and at the end creates a new ItemTemplate and add it, but just when is all data binded
I use this for calculating total hours in the collection. Even though I put it into the FooterTemplate
, you should be able to get the point.
<asp:Repeater ID="rptRecords" runat="server" OnItemDataBound="rptRecords_ItemDataBound">
protected void rptRecords_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
int totalHours = 0;
foreach (RepeaterItem item in ((Repeater)sender).Items)
{
Label lblRowHours = (Label)item.FindControl("lblHours");
if (lblRowHours != null)
totalHours += Convert.ToInt32(lblRowHours.Text);
}
((Label)e.Item.FindControl("lblHoursTotal")).Text = totalHours.ToString();
}
}