/// <summary> /// Bind the data grid to the list of file formats in the system. /// </summary> private void BindGrid() { var fileFormatService = new ImageCashLetterFileFormatService(new RockContext()); var types = fileFormatService.Queryable("EntityType") .OrderBy(f => f.Name) .ThenBy(f => f.Id) .ToList(); gFileFormat.EntityTypeId = EntityTypeCache.Read <ImageCashLetterFileFormat>().Id; gFileFormat.DataSource = types; gFileFormat.DataBind(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { var fileFormatService = new ImageCashLetterFileFormatService(new RockContext()); var fileFormats = fileFormatService.Queryable().Where(f => f.IsActive == true); ddlFileFormat.Items.Clear(); ddlFileFormat.Items.Add(new ListItem()); foreach (var fileFormat in fileFormats) { ddlFileFormat.Items.Add(new ListItem(fileFormat.Name, fileFormat.Id.ToString())); } } }