Beispiel #1
0
        protected void ActionRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e)
        {
            try
            {
                ActionLog current = e.Item.DataItem as ActionLog;

                if (current != null)
                {
                    Label dateLabel = e.Item.FindControl("DateLabel") as Label;
                    dateLabel.Text = current.Date.ToShortDateString();

                    Label actionLabel = e.Item.FindControl("ActionLabel") as Label;
                    actionLabel.Text = current.Action.Name;

                    Label durationLabel = e.Item.FindControl("DurationLabel") as Label;
                    durationLabel.Text = current.DurationInMinutes.ToString();

                    Label consumptionLabel = e.Item.FindControl("ConsumptionLabel") as Label;
                    consumptionLabel.Text = current.CalcConsumption().ToString();

                    ImageButton deleteButton = e.Item.FindControl("DeleteButton") as ImageButton;
                    deleteButton.CommandArgument = current.Guid.ToString();
                }
            }
            catch (Exception ex)
            {
                this.Master.ShowError(ex);
            }
        }