/// <summary> /// Controls how data is retrieved and bound to the control. /// </summary> protected override void PerformSelect() { if (this.DataSourceID.Length == 0) { this.OnDataBinding(EventArgs.Empty); } var ds = this.DataSource; if (ds != null) { _viewState = new TollingEventsListViewState(); Dictionary <int, string> mds = this.MessagesDataSource == null ? null : this.MessagesDataSource; foreach (var t in ds.OrderByDescending(t => t.TollingStartDate)) { string messageID; _viewState.Events.Add(new TollingEventsListViewState.TollingEventListItem() { Description = t.Description, StartDate = t.StartDate, EndDate = t.TollingEndDate, TollingDays = t.GetTollingDays(), Deadline = t.TollingDueDate, EndReason = CPConvert.ToString(t.TollingEndReason), MessageID = mds != null && mds.TryGetValue(t.IsInadequateResponse ? -t.TollingEventNumber : t.TollingEventNumber, out messageID) ? messageID : null }); } } this.MarkAsDataBound(); }
/// <summary> /// Restores view-state information from a previous page request that was saved by the SaveViewState method. /// </summary> /// <param name="savedState">An <see cref="Object"/> that represents the control state to be restored.</param> protected override void LoadViewState(object savedState) { Pair state = savedState as Pair; if (state != null) { _viewState = state.Second as TollingEventsListViewState; base.LoadViewState(state.First); } else { _viewState = new TollingEventsListViewState(); } }