Exemple #1
0
        public void InitializeWithField(Microsoft.SharePoint.SPField field)
        {
            parentField = field as CascadeDropdownFieldType;

            if (parentField != null)
            {
                CascadeType         = parentField.CascadeType;
                CascadeList         = parentField.CascadeList;
                CascadeParent       = parentField.CascadeParent;
                CascadeDisplayName  = parentField.CascadeDisplayField;
                CascadeCompareField = parentField.CascadeCompareField;
            }

            rblCascadeType.SelectedIndexChanged += rblCascadeType_SelectedIndexChanged;
            ddlParentList.SelectedIndexChanged  += ddlParentList_SelectedIndexChanged;
            ddlChildList.SelectedIndexChanged   += ddlChildList_SelectedIndexChanged;
            ddlChildLookup.SelectedIndexChanged += ddlChildLookup_SelectedIndexChanged;

            if (!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(CascadeType))
                {
                    rblCascadeType.SelectedIndex = 0;
                }
                else if (CascadeType == "Child")
                {
                    rblCascadeType.SelectedIndex = 1;
                }

                rblCascadeType_SelectedIndexChanged(null, EventArgs.Empty);
            }
        }
Exemple #2
0
        public void OnSaveChange(Microsoft.SharePoint.SPField field, bool isNewField)
        {
            ValidateSettings();

            this.Url              = txtUrl.Text.Trim();
            this.List             = (ddlList.SelectedIndex > 0) ? ddlList.SelectedValue : "";
            this.Field            = (ddlField.SelectedIndex > 0) ? ddlField.SelectedValue : "";
            this.ParentField      = (ddlParentField.SelectedIndex > 0) ? ddlParentField.SelectedValue : "";
            this.FilterValueField = (ddlFilterValueField.SelectedIndex > 0) ? ddlFilterValueField.SelectedValue : "";
            this.DefineNone       = chkDefineNone.Checked.ToString();

            if (chkFilterCriteria.Checked)
            {
                if (!string.IsNullOrEmpty((this.FilterValueField)))
                {
                    SPField parentField = field.ParentList.Fields.GetFieldByInternalName(this.FilterValueField);

                    if (parentField != null)
                    {
                        CascadingLookupField clParentField = parentField as CascadingLookupField;

                        string childFieldName = ((isNewField) ? ConvertToInternalName(field.Title) : field.InternalName) + "] ";

                        if (!clParentField.ChildrenField.Contains(childFieldName))
                        {
                            clParentField.ChildrenField += childFieldName;
                            clParentField.Update();
                        }
                    }
                }
            }

            CascadingLookupField clField = field as CascadingLookupField;

            if (isNewField)
            {
                clField.UpdateMyCustomProperty("Url", this.Url);
                clField.UpdateMyCustomProperty("List", this.List);
                clField.UpdateMyCustomProperty("Field", this.Field);
                clField.UpdateMyCustomProperty("ParentField", this.ParentField);
                clField.UpdateMyCustomProperty("ChildrenField", this.ChildrenField);
                clField.UpdateMyCustomProperty("FilterValueField", this.FilterValueField);
                clField.UpdateMyCustomProperty("DefineNone", this.DefineNone);
            }
            else
            {
                clField.Url              = this.Url;
                clField.List             = this.List;
                clField.Field            = this.Field;
                clField.ParentField      = this.ParentField;
                clField.ChildrenField    = CleanupChildrenField(field, this.ChildrenField);
                clField.FilterValueField = this.FilterValueField;
                clField.DefineNone       = this.DefineNone;
            }
        }
Exemple #3
0
        public void InitializeWithField(Microsoft.SharePoint.SPField field)
        {
            parentField = field as AutoCompleteFieldType;

            if (parentField != null)
            {
                searchListGuid = parentField.SearchListGuid;
                searchListName = parentField.SearchListName;
                chkAllowMultipleDLF.Checked = parentField.AllowMultiple;
                searchDisplayName           = parentField.DisplayColumn;
                //searchKeyName = parentField.KeyColumn;

                string columnGuids = parentField.SearchColumnGuids;

                if (!string.IsNullOrEmpty(columnGuids))
                {
                    searchColumnGuids = columnGuids.Split(',').ToList();
                }
            }

            ddlSearchList.SelectedIndexChanged += ddlSearchList_SelectedIndexChanged;

            if (!Page.IsPostBack)
            {
                using (SPWeb web = SPContext.Current.Web)
                {
                    SPListCollection lists = web.Lists;

                    foreach (SPList list in lists)
                    {
                        if (list.BaseType != SPBaseType.GenericList)
                        {
                            continue;
                        }

                        ListItem item = new ListItem();
                        item.Text  = list.Title;
                        item.Value = list.ID.ToString();
                        if (!String.IsNullOrEmpty(searchListGuid) && item.Value == searchListGuid)
                        {
                            item.Selected = true;
                        }

                        ddlSearchList.Items.Add(item);
                    }

                    PopulateFieldList();
                }
            }
        }
Exemple #4
0
        public void OnSaveChange(Microsoft.SharePoint.SPField field, bool isNewField)
        {
            InterestCalculatorField interestCalculatorField = (InterestCalculatorField)field;
            string interestRate = InterestRate.Text == string.Empty ? "0" : InterestRate.Text;

            if (isNewField)
            {
                interestCalculatorField.UpdateCustomProperty(interestRate);
            }
            else
            {
                interestCalculatorField.InterestRate = interestRate;
            }
        }
        public void InitializeWithField(Microsoft.SharePoint.SPField field)
        {
            txtListType.Text = Convert.ToString((int)SPContext.Current.List.BaseTemplate);
            foreach (SPField fld in SPContext.Current.List.Fields)
            {
                if (fld.TypeAsString.Contains("SPAttachmentField") == true)
                {
                    txtIsExist.Text = "True";
                }
            }

            if (field != null)
            {
                txtIsExist.Text = string.Empty;
            }
        }
Exemple #6
0
        public void OnSaveChange(Microsoft.SharePoint.SPField field, bool isNewField)
        {
            AutoCompleteFieldType customFieldType = field as AutoCompleteFieldType;

            if (customFieldType != null)
            {
                customFieldType.IsNew          = isNewField;
                customFieldType.SearchListGuid = ddlSearchList.SelectedItem.Value;
                customFieldType.SearchListName = ddlSearchList.SelectedItem.Text;
                customFieldType.AllowMultiple  = false;
                customFieldType.DisplayColumn  = ddlDisplayColumn.SelectedItem.Value;
                //customFieldType.KeyColumn = ddlKeyColumn.SelectedItem.Value;

                foreach (var postId in Request.Form.AllKeys)
                {
                    if (postId.Contains("chkAllowMultipleDLF"))
                    {
                        if (Request[postId] == "on")
                        {
                            customFieldType.AllowMultiple = true;
                        }
                        else
                        {
                            customFieldType.AllowMultiple = false;
                        }
                        break;
                    }
                }

                StringBuilder columnGuids = new StringBuilder();
                foreach (int colId in lbSearchColumns.GetSelectedIndices())
                {
                    ListItem item = lbSearchColumns.Items[colId];
                    columnGuids.Append(item.Value + ",");
                }
                customFieldType.SearchColumnGuids = columnGuids.ToString();

                customFieldType.LookupList  = ddlSearchList.SelectedItem.Value;
                customFieldType.LookupField = ddlDisplayColumn.SelectedItem.Value;
                customFieldType.LookupWebId = SPContext.Current.Web.ID;
            }
        }
Exemple #7
0
        public void InitializeWithField(Microsoft.SharePoint.SPField field)
        {
            CascadingLookupField clField = field as CascadingLookupField;

            if (clField != null)
            {
                this.Url              = clField.Url;
                this.List             = clField.List;
                this.Field            = clField.Field;
                this.ParentField      = clField.ParentField;
                this.ChildrenField    = clField.ChildrenField;
                this.FilterValueField = clField.FilterValueField;
                this.DefineNone       = clField.DefineNone;

                EnsureChildControls();

                // Remove the current field from the FilterValueField list
                ListItem item = ddlFilterValueField.Items.FindByValue(field.InternalName);
                if (item != null)
                {
                    ddlFilterValueField.Items.Remove(item);
                }
            }
        }
Exemple #8
0
        public void OnSaveChange(Microsoft.SharePoint.SPField field, bool isNewField)
        {
            CascadeDropdownFieldType customFieldType = field as CascadeDropdownFieldType;

            if (customFieldType != null)
            {
                customFieldType.IsNew = isNewField;
                if (rblCascadeType.SelectedIndex == 0) //Parent ROOT cascade list choice
                {
                    customFieldType.CascadeList         = ddlParentList.SelectedValue;
                    customFieldType.CascadeDisplayField = ddlParentListDisplayName.SelectedValue;
                    customFieldType.CascadeType         = "Parent";
                }
                else if (rblCascadeType.SelectedIndex == 1)
                {
                    customFieldType.CascadeType         = "Child";
                    customFieldType.CascadeParent       = ddlChildList.SelectedValue;
                    customFieldType.CascadeList         = ddlChildLookup.SelectedValue;
                    customFieldType.CascadeDisplayField = ddlChildLookupDisplayName.SelectedValue;

                    customFieldType.CascadeCompareField = GetCascadeParentCompareField();
                }
            }
        }
 public void OnSaveChange(Microsoft.SharePoint.SPField field, bool isNewField)
 {
 }