private void BuildAvailableItems(ref GroupedItemPicker m)
 {
     if (!Util.ListIsNullOrEmpty(_availableItems))
     {
         foreach (ListItem i in _availableItems)
         {
             m.AddItem(i.Value, i.Text, string.Empty, string.Empty);
         }
     }
 }
Пример #2
0
 private void BuildAvailableItems(ref GroupedItemPicker m)
 {
     if (_availableItems != null && _availableItems.Count != 0)
     {
         foreach (ListItem i in _availableItems)
         {
             m.AddItem(i.Value, i.Text, string.Empty, string.Empty);
         }
     }
 }
Пример #3
0
        public static void GetReferences(GroupedItemPicker groupItemPicker)
        {
            itemDetails = new Dictionary<int, string>();
            string query = string.Format(@"<Where>
                                                <And>
                                                    <Eq>
                                                        <FieldRef Name='Author' LookupId='True'/>
                                                        <Value Type='User'>{0}</Value>
                                                    </Eq>
                                                    <Neq>
                                                        <FieldRef Name='ID' />
                                                        <Value Type='Counter'>{1}</Value>
                                                    </Neq>
                                                </And>
                                            </Where>", SPContext.Current.Web.CurrentUser.ID, SPContext.Current.ItemId);
            SPQuery spQuery = new SPQuery();
            spQuery.ViewFields = string.Concat("<FieldRef Name='ID' />",
                                                "<FieldRef Name='Title' />",
                                                "<FieldRef Name='ContentType' />");
            spQuery.Query = query;
            SPListItemCollection referenceItems = SPContext.Current.List.GetItems(spQuery);
            foreach (SPListItem referenceItem in referenceItems)
            {
                itemDetails.Add(referenceItem.ID, referenceItem.Title);
                groupItemPicker.AddItem(referenceItem.ID.ToString(), referenceItem.Title, string.Empty, referenceItem["ContentType"].ToString());
            }

            if (SPContext.Current.ListItem["References"] != null)
            {
                SPFieldLookupValueCollection selectedReferences = SPContext.Current.ListItem["References"] as SPFieldLookupValueCollection;
                foreach (SPFieldLookupValue selectedReference in selectedReferences)
                {
                    groupItemPicker.AddSelectedItem(selectedReference.LookupId.ToString(), selectedReference.LookupValue);
                }
            }
        }
 private void BuildAvailableItems(ref GroupedItemPicker m)
 {
     if (_availableItems != null && _availableItems.Count != 0)
     {
         foreach (ListItem i in _availableItems)
         {
             m.AddItem(i.Value, i.Text, string.Empty, string.Empty);
         }
     }
 }