Beispiel #1
0
        protected override void CreateChildControls()
        {
            if (isFeatureActivated)
            {
                try
                {
                    for (int i = 0; i < Fields.Count; i++)
                    {
                        SPField field = Fields[i];
                        if (arrwpFields.Contains(field.InternalName) && mode == SPControlMode.Edit)
                        {
                            if ((bool)arrwpFields[field.InternalName])
                            {
                                TemplateContainer child = new TemplateContainer();
                                Controls.Add(child);

                                SetFieldName(child, field.InternalName);
                                SetControlMode(child, mode);

                                ControlTemplate.InstantiateIn(child);
                            }
                        }
                        else if (!IsFieldExcluded(field))
                        {
                            string editable = "";
                            try
                            {
                                editable = fieldProperties[field.InternalName]["Editable"];
                                editable = editable.Split(Separator.ToCharArray())[0].ToLower();
                            }
                            catch { }

                            if ((editable == "never" || editable == Where || field.Type == SPFieldType.Calculated) && mode != SPControlMode.New)
                            {
                                if (editable == Where && EditableFieldDisplay.canEdit(field, fieldProperties, this.ListItem))
                                {
                                    TemplateContainer child = new TemplateContainer();
                                    Controls.Add(child);

                                    SetFieldName(child, field.InternalName);
                                    SetControlMode(child, mode);

                                    ControlTemplate.InstantiateIn(child);
                                }
                                else
                                {
                                    TemplateContainer child = new TemplateContainer();
                                    Controls.Add(child);

                                    SetFieldName(child, field.InternalName);
                                    SetControlMode(child, SPControlMode.Display);

                                    ControlTemplate.InstantiateIn(child);
                                }
                            }
                            else
                            {
                                TemplateContainer child = new TemplateContainer();
                                Controls.Add(child);

                                SetFieldName(child, field.InternalName);
                                SetControlMode(child, mode);



                                ControlTemplate.InstantiateIn(child);
                            }
                        }
                    }
                }
                catch { }
                // prepopulate lookup fields with query string values

                InsertLookupValueByQueryString();

                // Add EPMLive custom entity picker control to
                // lookup fields
                if (Fields != null)
                {
                    foreach (SPField f in Fields)
                    {
                        AddTypeAheadFieldControls(f);
                    }
                }
                //AddEntityPickersToLookups();
            }
            else
            {
                base.CreateChildControls();
            }
        }