/// <summary> /// Binds the data. /// </summary> private void BindData() { var appointments = AppointmentCollection.Load(this.ModuleId, true); if (!this.IsEditable) { this.AppointmentToolTipManager.Visible = false; foreach (var appointment in appointments) { appointment.Title = Localization.GetString("Timeslot Taken", this.LocalResourceFile); } } this.AppointmentsCalendar.DataSource = appointments; this.AppointmentsCalendar.DataEndField = "EndDateTime"; this.AppointmentsCalendar.DataKeyField = "AppointmentId"; this.AppointmentsCalendar.DataStartField = "StartDateTime"; this.AppointmentsCalendar.DataSubjectField = "Title"; this.AppointmentsCalendar.DataBind(); this.AppointmentsCalendar.Skin = this.NewRequestToolTipManager.Skin = this.AppointmentToolTipManager.Skin = ModuleSettings.CalendarSkin.GetValueAsStringFor(this); this.AppointmentsCalendar.MonthView.VisibleAppointmentsPerDay = ModuleSettings.AppointmentsToDisplayPerDay.GetValueAsInt32For(this).Value; // Since we have to use FindControl to access the RadCalendar, it only works after DataBind has occurred. Utility.LocalizeCalendar(this.AppointmentsCalendar.FindControl("SelectedDateCalendar") as RadCalendar); }
/// <summary> /// Binds the data. /// </summary> /// <param name="rebindInPostback">if set to <c>true</c> rebinds to the <see cref="AppointmentCollection"/> during a postback.</param> private void BindData(bool rebindInPostback) { this.PagingControl.PageSize = ModuleSettings.AppointmentsPerPage.GetValueAsInt32For(this).Value; var appointments = AppointmentCollection.Load(this.ModuleId, null, null, this.CurrentPageIndex - 1, this.PagingControl.PageSize); this.SetupPagingControl(this.PagingControl, appointments.TotalRecords); if (!this.IsPostBack || rebindInPostback) { this.PendingAppointmentToolTipManager.TargetControls.Clear(); ScriptManager.RegisterStartupScript(this, typeof(AppointmentCalendar), "HideToolTip", "hideActiveToolTip();", true); this.AppointmentsGrid.DataSource = appointments; this.AppointmentsGrid.DataBind(); } if (this.AppointmentsGrid.HeaderRow != null) { this.AppointmentsGrid.HeaderRow.TableSection = TableRowSection.TableHeader; } }