private void RebindRepeater(string list, string table) { SPList shpList = SPContext.Current.Web.Lists[new Guid(list)]; var contentTypes = shpList.ContentTypes.OfType <SPContentType>(); var fields = shpList.Fields.OfType <SPField>().Where(fld => (!fld.Hidden || fld.InternalName.Equals("RecurrenceData")) && !_excludeListFields.Contains(fld.InternalName)); ColumnsMapperRep.DataSource = fields.Select(item => new { ListColumnTitle = item.Title, ListColumnInternalName = item.InternalName, ListColumnType = item.TypeAsString, ListColumnIsSupported = IsSharePointFieldSupportMapping(item), ListColumnEditPageUrl = string.Format(LIST_FIELD_EDIT_URL_TEMPLATE, SPContext.Current.Web.Url.TrimEnd('/'), shpList.ID.ToString(), item.InternalName), ListColumnToolTip = string.Format(LIST_FIELD_TOOLTIP_TEMPLATE, item.TypeAsString, String.Join(", ", contentTypes.Where(ct => ct.FieldLinks[item.Id] != null).Select(ct => ct.Name))), DBColumnIntName = (_predefinedMapping.ContainsKey(item.InternalName)) ? _predefinedMapping[item.InternalName] : "" }).OrderBy(item => item.ListColumnTitle); ColumnsMapperRep.DataBind(); // init ContentTypes repeater ContentTypesMapperRepeater.DataSource = shpList.ContentTypes.OfType <SPContentType>().Select(ct => new { ListCtId = ct.Id.ToString(), ListCtTitle = ct.Name, ListCtEditPageUrl = string.Format(LIST_CT_EDIT_URL_TEMPLATE, SPContext.Current.Web.Url.TrimEnd('/'), shpList.ID.ToString(), ct.Id.ToString()), }); ContentTypesMapperRepeater.DataBind(); }
private void UpdateMapperDataSourceFields(string tableName, ICollection <ListMappingField> mapFields, string key) { var fields = _configService.TablesFields(tableName); ColumnsMapperRep.DataSource = fields.Where(item => !String.Equals(item, key, StringComparison.InvariantCultureIgnoreCase)).Select(item => new { DbColumnName = item, DbColumnId = item, ShPColumnIntName = mapFields == null ? "" : mapFields.Where(f => f.FieldName == item).Select(f => f.ItemName).FirstOrDefault() }); ColumnsMapperRep.DataBind(); }