/// <summary> /// Binds the filter. /// </summary> private void BindFilter() { var rockContext = new RockContext(); var sites = new SiteService( rockContext ).Queryable().OrderBy( s => s.Name ).ToList(); ddlSiteFilter.DataSource = sites; ddlSiteFilter.DataBind(); ddlSiteFilter.Items.Insert( 0, Rock.Constants.All.ListItem ); ddlSiteFilter.Visible = sites.Any(); ddlSiteFilter.SetValue( gContentListFilter.GetUserPreference( "Site" ) ); var item = ddlApprovedFilter.Items.FindByValue( gContentListFilter.GetUserPreference( "Approval Status" ) ); if ( item != null ) { item.Selected = true; } else { ddlApprovedFilter.SelectedIndex = 2; } int? personId = gContentListFilter.GetUserPreference( "Approved By" ).AsIntegerOrNull(); if ( personId.HasValue ) { var personService = new PersonService( rockContext ); var person = personService.Get( personId.Value ); if ( person != null ) { ppApprovedByFilter.SetValue( person ); } } }