/// ----------------------------------------------------------------------------- /// <summary> /// CreateEditor creates the control collection. /// </summary> /// <history> /// [cnurse] 05/08/2006 created /// </history> /// ----------------------------------------------------------------------------- protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "ProfileVisibility"; LengthDataField = "Length"; base.CreateEditor(); foreach (FieldEditorControl editor in Fields) { //Check whether Field is readonly string fieldName = editor.Editor.Name; ProfilePropertyDefinitionCollection definitions = editor.DataSource as ProfilePropertyDefinitionCollection; ProfilePropertyDefinition definition = definitions[fieldName]; if (definition != null && definition.ReadOnly && (editor.Editor.EditMode == PropertyEditorMode.Edit)) { PortalSettings ps = PortalController.Instance.GetCurrentPortalSettings(); if (!PortalSecurity.IsInRole(ps.AdministratorRoleName)) { editor.Editor.EditMode = PropertyEditorMode.View; } } //We need to wire up the RegionControl to the CountryControl if (editor.Editor is DNNRegionEditControl) { string country = null; foreach (FieldEditorControl checkEditor in Fields) { if (checkEditor.Editor is DNNCountryEditControl) { var countryEdit = (DNNCountryEditControl)checkEditor.Editor; country = Convert.ToString(countryEdit.Value); } } //Create a ListAttribute for the Region string countryKey; if (country != null) { countryKey = "Country." + country; } else { countryKey = "Country.Unknown"; } var attributes = new object[1]; attributes[0] = new ListAttribute("Region", countryKey, ListBoundField.Value, ListBoundField.Text); editor.Editor.CustomAttributes = attributes; } } }
/// <Summary>CreateEditor creates the control collection.</Summary> protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "Visibility"; LengthDataField = "Length"; base.CreateEditor(); //We need to wire up the RegionControl to the CountryControl foreach( FieldEditorControl editor in Fields ) { if( editor.Editor is DNNRegionEditControl ) { ListEntryInfo country = null; foreach( FieldEditorControl checkEditor in Fields ) { if( checkEditor.Editor is DNNCountryEditControl ) { DNNCountryEditControl countryEdit = (DNNCountryEditControl)checkEditor.Editor; ListController objListController = new ListController(); ListEntryInfoCollection countries = objListController.GetListEntryInfoCollection( "Country" ); foreach( ListEntryInfo checkCountry in countries ) { if( checkCountry.Text == countryEdit.Value.ToString() ) { country = checkCountry; break; } } } } //Create a ListAttribute for the Region string countryKey; if( country != null ) { countryKey = "Country." + country.Value; } else { countryKey = "Country.Unknown"; } object[] attributes; attributes = new object[1]; attributes[0] = new ListAttribute( "Region", countryKey, ListBoundField.Text, ListBoundField.Text ); editor.Editor.CustomAttributes = attributes; } } }
/// <Summary>CreateEditor creates the control collection.</Summary> protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "Visibility"; LengthDataField = "Length"; base.CreateEditor(); //We need to wire up the RegionControl to the CountryControl foreach (FieldEditorControl editor in Fields) { if (editor.Editor is DNNRegionEditControl) { ListEntryInfo country = null; foreach (FieldEditorControl checkEditor in Fields) { if (checkEditor.Editor is DNNCountryEditControl) { DNNCountryEditControl countryEdit = (DNNCountryEditControl)checkEditor.Editor; ListController objListController = new ListController(); ListEntryInfoCollection countries = objListController.GetListEntryInfoCollection("Country"); foreach (ListEntryInfo checkCountry in countries) { if (checkCountry.Text == countryEdit.Value.ToString()) { country = checkCountry; break; } } } } //Create a ListAttribute for the Region string countryKey; if (country != null) { countryKey = "Country." + country.Value; } else { countryKey = "Country.Unknown"; } object[] attributes; attributes = new object[1]; attributes[0] = new ListAttribute("Region", countryKey, ListBoundField.Text, ListBoundField.Text); editor.Editor.CustomAttributes = attributes; } } }
/// <Summary> /// OnAttributesChanged runs when the CustomAttributes property has changed. /// </Summary> protected override void OnAttributesChanged() { //Get the List settings out of the "Attributes" if (CustomAttributes != null) { foreach (Attribute attribute in CustomAttributes) { if (attribute is ListAttribute) { ListAttribute listAtt = (ListAttribute)attribute; ListName = listAtt.ListName; ParentKey = listAtt.ParentKey; TextField = listAtt.TextField; ValueField = listAtt.ValueField; break; } } } }
void OnItemChanged(object sender, PropertyEditorEventArgs e) { var regionContainer = ControlUtilities.FindControl<Control>(Parent, "Region", true); if (regionContainer != null) { var regionControl = ControlUtilities.FindFirstDescendent<DNNRegionEditControl>(regionContainer); if (regionControl != null) { var listController = new ListController(); var countries = listController.GetListEntryInfoItems("Country"); foreach (var checkCountry in countries) { if (checkCountry.Text == e.StringValue) { var attributes = new object[1]; attributes[0] = new ListAttribute("Region", "Country." + checkCountry.Value, ListBoundField.Text, ListBoundField.Text); regionControl.CustomAttributes = attributes; break; } } } } }
void OnItemChanged(object sender, PropertyEditorEventArgs e) { var regionContainer = ControlUtilities.FindControl <Control>(Parent, "Region", true); if (regionContainer != null) { var regionControl = ControlUtilities.FindFirstDescendent <DNNRegionEditControl>(regionContainer); if (regionControl != null) { var listController = new ListController(); var countries = listController.GetListEntryInfoItems("Country"); foreach (var checkCountry in countries) { if (checkCountry.EntryID.ToString() == e.StringValue) { var attributes = new object[1]; attributes[0] = new ListAttribute("Region", "Country." + checkCountry.Value, ListBoundField.Id, ListBoundField.Text); regionControl.CustomAttributes = attributes; break; } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateEditor creates the control collection. /// </summary> /// <history> /// [cnurse] 05/08/2006 created /// </history> /// ----------------------------------------------------------------------------- protected override void CreateEditor() { CategoryDataField = "PropertyCategory"; EditorDataField = "DataType"; NameDataField = "PropertyName"; RequiredDataField = "Required"; ValidationExpressionDataField = "ValidationExpression"; ValueDataField = "PropertyValue"; VisibleDataField = "Visible"; VisibilityDataField = "ProfileVisibility"; LengthDataField = "Length"; base.CreateEditor(); foreach (FieldEditorControl editor in Fields) { //Check whether Field is readonly string fieldName = editor.Editor.Name; ProfilePropertyDefinitionCollection definitions = editor.DataSource as ProfilePropertyDefinitionCollection; ProfilePropertyDefinition definition = definitions[fieldName]; if (definition != null && definition.ReadOnly && (editor.Editor.EditMode == PropertyEditorMode.Edit)) { PortalSettings ps = PortalController.GetCurrentPortalSettings(); if (!PortalSecurity.IsInRole(ps.AdministratorRoleName)) { editor.Editor.EditMode = PropertyEditorMode.View; } } //We need to wire up the RegionControl to the CountryControl if (editor.Editor is DNNRegionEditControl) { ListEntryInfo country = null; foreach (FieldEditorControl checkEditor in Fields) { if (checkEditor.Editor is DNNCountryEditControl) { var countryEdit = (DNNCountryEditControl) checkEditor.Editor; var objListController = new ListController(); var countries = objListController.GetListEntryInfoItems("Country"); foreach (ListEntryInfo checkCountry in countries) { if (checkCountry.Text == Convert.ToString(countryEdit.Value)) { country = checkCountry; break; } } } } //Create a ListAttribute for the Region string countryKey; if (country != null) { countryKey = "Country." + country.Value; } else { countryKey = "Country.Unknown"; } var attributes = new object[1]; attributes[0] = new ListAttribute("Region", countryKey, ListBoundField.Text, ListBoundField.Text); editor.Editor.CustomAttributes = attributes; } } }