Beispiel #1
0
        /// <summary>
        /// Creates the controls required for association.
        /// </summary>
        private void CreatePredicateAndObjectControls()
        {
            _predicateLabel = CreateLabel(GlobalResource.AssociationPredicateLabel, _predicateLabelId);

            List <NavigationProperty> navigationalProperties = null;

            using (ResourceDataAccess dataAccess = new ResourceDataAccess(this.CreateContext()))
            {
                navigationalProperties = dataAccess.GetNavigationalProperties(this.Page.Cache,
                                                                              typeName).OrderBy(property => property.Name).ToList();
            }


            _predicateDropDownList = CreateDropDownList(null, _predicateDataTextField,
                                                        _predicateDataValueField, true, _predicateDropDownId);

            foreach (NavigationProperty property in navigationalProperties)
            {
                _predicateDropDownList.Items.Add(new ListItem(property.Name, property.Id.ToString()));
            }

            if (!string.IsNullOrEmpty(SelectedPredicateId))
            {
                _predicateDropDownList.SelectedValue = SelectedPredicateId;
            }

            _predicateDropDownList.SelectedIndexChanged += new EventHandler
                                                               (PredicateTypeDropDownList_SelectedIndexChanged);

            _objectTypeLabel = CreateLabel(null, _objectLabelId);

            _objectTypeDropDownList = CreateDropDownList(null, "Name", "FullName", true, _ObjectDropDownId);
            _objectTypeDropDownList.SelectedIndexChanged += new EventHandler
                                                                (ObjectTypeDropDownList_SelectedIndexChanged);
        }