how to show combobox in the PropertyGrid?

Page 1 of 2 12 LastLast
  1. #1

    how to show combobox in the PropertyGrid?

    the combobox can't show in the PropertyGrid of the Examples Explorer (Version 2.1) when I click the "red".
    https://examples2.ext.net/#/Property...asic/Overview/
    <ext:PropertyGridParameter Name="color" DisplayName="Color" Value="Red">
                        <Editor>
                            <ext:ComboBox runat="server" ForceSelection="true">
                                <Items>
                                    <ext:ListItem Text="Red" /> 
                                    <ext:ListItem Text="Green" /> 
                                    <ext:ListItem Text="Blue" /> 
                                </Items>
                            </ext:ComboBox>
                        </Editor>
                        <Renderer Handler="return Ext.String.format('<span style=\'color: {0};\'>{1}</span>', value.toLowerCase(), value);" />
                    </ext:PropertyGridParameter>
    Click image for larger version. 

Name:	propertygrid.png 
Views:	52 
Size:	11.4 KB 
ID:	5914
  2. #2
    Hi @hongxue,

    Thank you for the report. It has been fixed in the SVN trunk and will be included into the upcoming v2.2 release.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @hongxue,

    Thank you for the report. It has been fixed in the SVN trunk and will be included into the upcoming v2.2 release.
    Hi Daniil

    Im developing with the last "Community" version 2.1.1, for an internal school project, there is another fix for this issue?

    Thanks in advance

    Horace
  4. #4
    Hi Horace,

    Do you have v2.1.1 sources?
  5. #5
    Quote Originally Posted by Daniil View Post
    Hi Horace,

    Do you have v2.1.1 sources?
    Yes Daniil, I have the 2.1.1 sources.

    Thanks in advance
  6. #6
    Please try to rebuild Ext.NET with this PropertyGrid.cs.

    PropertyGrid.cs
    /********
     * @version   : 2.2.0 - Ext.NET Pro License
     * @author    : Ext.NET, Inc. http://www.ext.net/
     * @date      : 2013-04-16
     * @copyright : Copyright (c) 2007-2013, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
     * @license   : See license.txt and http://www.ext.net/license/. 
     ********/
    
    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Web.UI;
    
    using Ext.Net.Utilities;
    using Newtonsoft.Json.Linq;
    
    namespace Ext.Net
    {
        /// <summary>
        /// A specialized grid implementation intended to mimic the traditional property grid as typically seen in development IDEs. Each row in the grid represents a property of some object, and the data is stored as a set of name/value pairs in Properties.
        /// </summary>
        [Meta]
        [ToolboxData("<{0}:PropertyGrid runat=\"server\"></{0}:PropertyGrid>")]
        [ToolboxBitmap(typeof(GridPanel), "Build.ToolboxIcons.GridPanel.bmp")]
        [Designer(typeof(EmptyDesigner))]
        [Description("A specialized grid implementation intended to mimic the traditional property grid as typically seen in development IDEs. Each row in the grid represents a property of some object, and the data is stored as a set of name/value pairs in Properties.")]
        public partial class PropertyGrid : GridPanelBase, IPostBackEventHandler
        {
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            public PropertyGrid() { }
    
            /// <summary>
            /// 
            /// </summary>
            [Category("0. About")]
            [Description("")]
            public override string XType
            {
                get
                {
                    return "propertygrid";
                }
            }
    
            /// <summary>
            /// 
            /// </summary>
            [Category("0. About")]
            [Description("")]
            public override string InstanceOf
            {
                get
                {
                    return "Ext.grid.property.Grid";
                }
            }
    
            /// <summary>
            /// true to add css for column separation lines. Defaults to: true.
            /// </summary>
            [Meta]
            [ConfigOption]
            [Category("6. TablePanel")]
            [DefaultValue(true)]
            [Description("true to add css for column separation lines. Defaults to: true.")]
            public override bool ColumnLines
            {
                get
                {
                    return this.State.Get<bool>("ColumnLines", true);
                }
                set
                {
                    this.State.Set("ColumnLines", value);
                }
            }
            
            private PropertyGridParameterCollection source;
    
            /// <summary>
            /// A data object to use as the data source of the grid.
            /// </summary>
            [Meta]
            [Category("8. PropertyGrid")]
            [NotifyParentProperty(true)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [Description("A data object to use as the data source of the grid.")]
            public virtual PropertyGridParameterCollection Source
            {
                get
                {
                    if (this.source == null)
                    {
                        this.source = new PropertyGridParameterCollection();
                        this.source.AfterItemAdd += Source_AfterItemAdd;
                        this.source.AfterItemRemove += Source_AfterItemRemove;
                    }
    
                    return this.source;
                }
            }
    
            [ConfigOption("source", JsonMode.Raw)]
            [DefaultValue("")]
            protected virtual string SourceProxy
            {
                get
                {
                    return this.Source.Source();
                }
            }
    
            [ConfigOption("sourceConfig", JsonMode.Raw)]
            [DefaultValue("")]
            protected virtual string SourceConfigProxy
            {
                get
                {
                    return this.Source.Config();
                }
            }
    
            void Source_AfterItemAdd(PropertyGridParameter item)
            {
                if (item.Editor.Count > 0)
                {
                    this.AddEditor(item.Editor.Primary);
                }
    
                item.Editor.AfterItemAdd += AddEditor;
                item.Editor.AfterItemRemove += RemoveEditor;
            }
    
            void Source_AfterItemRemove(PropertyGridParameter item)
            {
                if (item.Editor.Count > 0)
                {
                    this.RemoveEditor(item.Editor.Primary);
                }
            }
    
            protected virtual void AddEditor(Field editor)
            {
                editor.EnableViewState = false;
    
                if (!this.Controls.Contains(editor))
                {
                    this.Controls.Add(editor);
                }
    
                if (!this.LazyItems.Contains(editor))
                {
                    this.LazyItems.Add(editor);
                }
            }
    
            protected virtual void RemoveEditor(Field editor)
            {
                if (this.Controls.Contains(editor))
                {
                    this.Controls.Remove(editor);
                }
    
                if (this.LazyItems.Contains(editor))
                {
                    this.LazyItems.Remove(editor);
                }
            }
    
            /// <summary>
            /// Sets the source data object containing the property data. The data object can contain one or more name/value pairs representing all of the properties of an object to display in the grid, and this data will automatically be loaded into the grid's store. The values should be supplied in the proper data type if needed, otherwise string type will be assumed. If the grid already contains data, this method will replace any existing data. See also the source config value. 
            /// </summary>
            /// <param name="source">The data object</param>
            /// <param name="sourceConfig"></param>
            public void SetSource(PropertyGridParameterCollection sourceConfig)
            {
                this.SetSource(sourceConfig, false);
            }
    
            /// <summary>
            /// Sets the source data object containing the property data. The data object can contain one or more name/value pairs representing all of the properties of an object to display in the grid, and this data will automatically be loaded into the grid's store. The values should be supplied in the proper data type if needed, otherwise string type will be assumed. If the grid already contains data, this method will replace any existing data. See also the source config value. 
            /// </summary>
            /// <param name="source">The data object</param>
            public void SetSource(PropertyGridParameterCollection sourceConfig, bool dynamic)
            {
                string sc = sourceConfig.Config(dynamic);
    
                if (sc.IsEmpty())
                {
                    this.Call("setSource", JRawValue.From(sourceConfig.Source()));
                }
                else
                {
                    this.Call("setSource", JRawValue.From(sourceConfig.Source()), JRawValue.From(sc));
                }
            }
    
            /// <summary>
            /// Sets the source data object containing the property data. The data object can contain one or more name/value pairs representing all of the properties of an object to display in the grid, and this data will automatically be loaded into the grid's store. The values should be supplied in the proper data type if needed, otherwise string type will be assumed. If the grid already contains data, this method will replace any existing data. See also the source config value. 
            /// </summary>
            /// <param name="source">The data object</param>
            public void SetSource(object source, bool clearConfig)
            {
                if (clearConfig)
                {
                    this.Call("setSource", JRawValue.Null);
                }
                else
                {
                    this.Call("setSource", source);
                }
            }
    
            /// <summary>
            /// Sets the source data object containing the property data. The data object can contain one or more name/value pairs representing all of the properties of an object to display in the grid, and this data will automatically be loaded into the grid's store. The values should be supplied in the proper data type if needed, otherwise string type will be assumed. If the grid already contains data, this method will replace any existing data. See also the source config value. 
            /// </summary>
            /// <param name="source">The data object</param>
            public void SetSource(object source)
            {
                this.Call("setSource", JRawValue.Null);
            }
    
            /// <summary>
            /// If false then all cells will be read only
            /// </summary>
            /// <value><c>true</c> if editable; otherwise, <c>false</c>.</value>
            [Meta]
            [ConfigOption]
            [Category("8. PropertyGrid")]
            [NotifyParentProperty(true)]
            [DefaultValue(true)]
            [Description("If false then all cells will be read only")]
            public virtual bool Editable
            {
                get
                {
                    return this.State.Get<bool>("Editable", true);
                }
                set
                {
                    this.State.Set("Editable", value);
                }
            }
    
            /// <summary>
            /// True to automatically infer the type based on the initial value passed for each field. This ensures the editor remains the correct type even if the value is blanked and becomes empty. Defaults to: true
            /// </summary>
            [Meta]
            [ConfigOption]
            [Category("8. PropertyGrid")]
            [NotifyParentProperty(true)]
            [DefaultValue(true)]
            [Description("True to automatically infer the type based on the initial value passed for each field. This ensures the editor remains the correct type even if the value is blanked and becomes empty. Defaults to: true")]
            public virtual bool InferTypes
            {
                get
                {
                    return this.State.Get<bool>("InferTypes", true);
                }
                set
                {
                    this.State.Set("InferTypes", value);
                }
            }
    
            /// <summary>
            /// Optional. Specify the width for the name column. The value column will take any remaining space. Defaults to 115.
            /// </summary>
            [Meta]
            [ConfigOption]
            [Category("8. PropertyGrid")]
            [NotifyParentProperty(true)]
            [DefaultValue(115)]
            [Description("Optional. Specify the width for the name column. The value column will take any remaining space. Defaults to 115.")]
            public virtual int NameColumnWidth
            {
                get
                {
                    return this.State.Get<int>("NameColumnWidth", 115);
                }
                set
                {
                    this.State.Set("NameColumnWidth", value);
                }
            }        
    
            private static readonly object EventDataChanged = new object();
    
            /// <summary>
            /// Fires when the the PropertyGrid has changed records
            /// </summary>
            [Category("Action")]
            [Description("Fires when the the PropertyGrid has changed records")]
            public event EventHandler DataChanged
            {
                add
                {
                    this.CheckForceId();
                    this.Events.AddHandler(EventDataChanged, value);
                }
                remove
                {
                    this.Events.RemoveHandler(EventDataChanged, value);
                }
            }
    
            /// <summary>
            /// 
            /// </summary>
            /// <param name="e"></param>
            [Description("")]
            protected virtual void OnDataChanged(EventArgs e)
            {
                EventHandler handler = (EventHandler)Events[EventDataChanged];
    
                if (handler != null)
                {
                    handler(this, e);
                }
            }
    
            private bool baseLoadPostData;
    
            /// <summary>
            /// 
            /// </summary>
            /// <param name="postDataKey"></param>
            /// <param name="postCollection"></param>
            /// <returns></returns>
            [Description("")]
            protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
            {
                baseLoadPostData = base.LoadPostData(postDataKey, postCollection);
                string val = postCollection[this.ConfigID];
    
                if (val.IsNotEmpty())
                {
                    this.BuildSource(val);
                    return true;
                }
    
                return false || baseLoadPostData;
            }
    
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            protected override void RaisePostDataChangedEvent()
            {
                if (this.baseLoadPostData)
                {
                    base.RaisePostDataChangedEvent();
                    this.baseLoadPostData = false;
                }
                
                if (raiseChanged)
                {
                    this.OnDataChanged(EventArgs.Empty);
                    raiseChanged = false;
                }
            }
    
            /// <summary>
            /// 
            /// </summary>
            /// <param name="eventArgument"></param>
            [Description("")]
            public void RaisePostBackEvent(string eventArgument)
            {           
            }
    
            private string ChopQuotes(string value)
            {
                if (value.IsNotEmpty() && value.StartsWith("\"") && value.EndsWith("\""))
                {
                    return value.Chop();
                }
    
                return value;
            }
    
            private PropertyGridParameter FindParam(string name)
            {
                foreach (PropertyGridParameter parameter in this.Source)
                {
                    if (parameter.Name == name)
                    {
                        return parameter;
                    }
                }
    
                return null;
            }
    
            private bool dataChangedEventHandled = false;
            bool raiseChanged = false;
            
            void BuildSource(string strSource)
            {
                if (this.dataChangedEventHandled)
                {
                    return;
                }
                
                PropertyGridParameterCollection result = new PropertyGridParameterCollection();
                JObject jo = JObject.Parse(strSource);
    
                foreach (JProperty property in jo.Properties())
                {
                    string value = property.Value.Type == JTokenType.String ? (string)property.Value : this.ChopQuotes(property.Value.ToString());
                    PropertyGridParameter newP = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                    PropertyGridParameter param = this.FindParam(property.Name);
    
                    if (param == null)
                    {
                        param = new PropertyGridParameter(this.ChopQuotes(property.Name), value);
                        param.IsChanged = true;
                    }
                    else
                    {
                        param.IsChanged = param.Value != value;
                        param.Value = value;                    
                    }
    
                    if (param.IsChanged)
                    {
                        raiseChanged = true;
                    }
                    result.Add(param);
                }
    
                this.Source.Clear();
                this.Source.AddRange(result);
    
                this.dataChangedEventHandled = true;
            }
    
            private PropertyGridListeners listeners;
    
            /// <summary>
            /// Client-side JavaScript Event Handlers
            /// </summary>
            [Meta]
            [ConfigOption("listeners", JsonMode.Object)]
            [Category("2. Observable")]
            [NotifyParentProperty(true)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            [Description("Client-side JavaScript Event Handlers")]
            public PropertyGridListeners Listeners
            {
                get
                {
                    if (this.listeners == null)
                    {
                        this.listeners = new PropertyGridListeners();
                    }
    
                    return this.listeners;
                }
            }
    
            private PropertyGridDirectEvents directEvents;
    
            /// <summary>
            /// Server-side Ajax Event Handlers
            /// </summary>
            [Meta]
            [Category("2. Observable")]
            [NotifyParentProperty(true)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            [ConfigOption("directEvents", JsonMode.Object)]
            [Description("Server-side Ajax Event Handlers")]
            public PropertyGridDirectEvents DirectEvents
            {
                get
                {
                    if (this.directEvents == null)
                    {
                        this.directEvents = new PropertyGridDirectEvents(this);
                    }
    
                    return this.directEvents;
                }
            }
    
            /// <summary>
            /// Adds the property.
            /// </summary>
            /// <param name="property"></param>
            [Description("Adds the property.")]
            public void AddProperty(PropertyGridParameter property)
            {
                string config = property.ToConfig(true);
                
                if (config.IsNotEmpty())
                {
                    this.AddScript("Ext.apply({0}.sourceConfig, {{{1}}});", this.ClientID, config);
                }
    
                this.Call("setProperty", property.ToName(), property.ValueToString(), true);
            }
    
            /// <summary>
            /// Updates the property.
            /// </summary>
            /// <param name="propertyName">The name of the property</param>
            /// <param name="value">New value of the property</param>
            [Description("Updates the property.")]
            public void UpdateProperty(string propertyName, object value)
            {
                this.Call("setProperty", propertyName, value);
            }
    
            /// <summary>
            /// Removes a property from the grid.
            /// </summary>
            /// <param name="propertyName">The name of the property to remove</param>
            [Description("Removes a property from the grid.")]
            public void RemoveProperty(string propertyName)
            {
                this.Call("removeProperty", propertyName);
            }
        }
    }
  7. #7
    Hi Daniil

    I have tried rebuid with this PropertyGrid.cs and I get one error message:

    No overload for method 'Config' takes 1 arguments D:\Ext.NET.Community.2.1.1\Ext.Net\Ext\Grid\Proper ty\PropertyGrid.cs Line 210 Col 25

    The line (In the public void SetSource(PropertyGridParameterCollection sourceConfig, bool dynamic) overload) is:

    string sc = sourceConfig.Config(dynamic);

    I guess that PropertyGridParameter.cs file was changed also (SVN commit 4979 related to this issue).

    Thanks in advance.

    Horace
  8. #8
    Correct.

    Here is PropertyGridParameter.cs.

    PropertyGridParameter.cs
    /********
     * @version   : 2.2.0 - Ext.NET Pro License
     * @author    : Ext.NET, Inc. http://www.ext.net/
     * @date      : 2013-04-16
     * @copyright : Copyright (c) 2007-2013, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
     * @license   : See license.txt and http://www.ext.net/license/. 
     ********/
    
    using System.ComponentModel;
    using System.Text;
    using System.Web.UI;
    
    using Ext.Net.Utilities;
    using System.Collections.Generic;
    
    namespace Ext.Net
    {
        /// <summary>
        /// 
        /// </summary>
        [Meta]
        [Description("")]
        public partial class PropertyGridParameter : BaseParameter
        {
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            public PropertyGridParameter() { }
    
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            public PropertyGridParameter(string name, string value) : base(name, value) { }
    
            /// <summary>
            /// A custom name to appear as label for this field. If specified, the display name will be shown in the name column instead of the property name.
            /// </summary>
            [Meta]
            [Category("Config Options")]
            [NotifyParentProperty(true)]
            [DefaultValue("")]
            [Description("A custom name to appear as label for this field. If specified, the display name will be shown in the name column instead of the property name.")]
            public string DisplayName
            {
                get
                {
                    return this.State.Get<string>("DisplayName", "");
                }
                set
                {
                    this.State.Set("DisplayName", value);
                }
            }
    
            private Renderer renderer;
    
            /// <summary>
            /// A function used to transform the underlying value before it is displayed in the grid. By default, the grid supports strongly-typed rendering of strings, dates, numbers and booleans using built-in form editors, but any custom type can be supported and associated with the type of the value. 
            ///
            /// The render function is called with the following parameters:
            ///     value : Object
            ///         The data value for the cell.
            ///     metadata : Object
            ///         An object in which you may set the following attributes:
            ///         
            ///         css : String
            ///             A CSS class name to add to the cell's TD element.
            ///         attr : String
            ///             An HTML attribute definition string to apply to the data container element
            ///              within the table cell (e.g. 'style="color:red;"').
            ///     
            ///     record : Ext.data.record
            ///         The Ext.data.Record from which the data was extracted.
            /// Returns:
            ///     void
            /// </summary>
            [Category("Config Options")]
            [DefaultValue(null)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [Description("A function used to transform the underlying value before it is displayed in the grid. By default, the grid supports strongly-typed rendering of strings, dates, numbers and booleans using built-in form editors, but any custom type can be supported and associated with the type of the value. ")]
            public virtual Renderer Renderer
            {
                get
                {
                    if (this.renderer == null)
                    {
                        this.renderer = new Renderer();
                    }
    
                    return this.renderer;
                }
            }
    
            /// <summary>
            /// Used to explicitly specify the editor type for a particular value. By default, the type is automatically inferred from the value. See inferTypes.
            /// </summary>
            [Meta]
            [Category("Config Options")]
            [NotifyParentProperty(true)]
            [DefaultValue(PropertyGridEditorType.Auto)]
            [Description("Used to explicitly specify the editor type for a particular value. By default, the type is automatically inferred from the value. See inferTypes.")]
            public PropertyGridEditorType EditorType
            {
                get
                {
                    return this.State.Get<PropertyGridEditorType>("EditorType", PropertyGridEditorType.Auto);
                }
                set
                {
                    this.State.Set("EditorType", value);
                }
            }
    
            private EditorCollection editor;
    
            /// <summary>
            /// Allows the grid to support additional types of editable fields. By default, the grid supports strongly-typed editing of strings, dates, numbers and booleans using built-in form editors, but any custom type can be supported and associated with a custom input control by specifying a custom editor.
            /// </summary>
            [Meta]
            [Category("Config Options")]
            [NotifyParentProperty(true)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [Description("Allows the grid to support additional types of editable fields. By default, the grid supports strongly-typed editing of strings, dates, numbers and booleans using built-in form editors, but any custom type can be supported and associated with a custom input control by specifying a custom editor.")]
            public virtual EditorCollection Editor
            {
                get
                {
                    if (this.editor == null)
                    {
                        editor = new EditorCollection();
                    }
    
                    return editor;
                }
            }
    
            private CellEditorOptions editorOptions;
    
            /// <summary>
            /// Editor options
            /// </summary>
            [Meta]
            [NotifyParentProperty(true)]
            [PersistenceMode(PersistenceMode.InnerProperty)]
            [Description("Editor options")]
            public virtual CellEditorOptions EditorOptions
            {
                get
                {
                    if (this.editorOptions == null)
                    {
                        editorOptions = new CellEditorOptions();
                    }
    
                    return editorOptions;
                }
            }
            
            private bool isChanged;
    
            /// <summary>
            /// 
            /// </summary>
            [Browsable(false)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
            [DefaultValue(false)]
            [Description("")]
            public bool IsChanged
            {
                get 
                { 
                    return this.isChanged; 
                }
                internal set 
                { 
                    this.isChanged = value; 
                }
            }
    
            public virtual string ToConfig()
            {
                return this.ToConfig(false);
            }
    
            public virtual string ToConfig(bool dynamic)
            {
                StringBuilder sb = new StringBuilder(256);
                bool comma = false;
                sb.Append(JSON.Serialize(this.ToName()) + ":{");
    
                if (this.DisplayName.IsNotEmpty())
                {
                    sb.Append("displayName:").Append(JSON.Serialize(this.DisplayName));
                    comma = true;
                }
    
                if (!this.Renderer.IsDefault)
                {                
                    sb.Append(comma ? ",":"").Append("renderer:").Append(this.Renderer.ToConfigString());
                    comma = true;
                }
    
                if (this.EditorType != PropertyGridEditorType.Auto)
                {
                    sb.Append(comma ? "," : "").Append("type:").Append(JSON.Serialize(this.EditorType.ToString().ToLowerInvariant()));
                    comma = true;
                }
    
                if (this.Editor.Count > 0)
                {
                    string options = this.EditorOptions.Serialize();
                    options = options.Replace("{", "{{").Replace("}", "}}").Replace("\"", "'");
                    string tpl = "new " + this.EditorOptions.InstanceName + "(Ext.apply({{field:{0}}}, " + options + "))";
                    sb.Append(comma ? "," : "").Append("editor:");
    
                    if(dynamic)
                    {                
                        this.Editor[0].PreventRenderTo = true;
                        this.Editor[0].Visible = true;
                        sb.AppendFormat(tpl, this.Editor[0].ToConfig(LazyMode.Config));
                        this.Editor[0].Visible = false;
                    }
                    else
                    {                   
                        sb.Append(Transformer.NET.Net.CreateToken(typeof(Transformer.NET.AnchorTag), new Dictionary<string, string>{                        
                            {"id", this.Editor[0].BaseClientID + "_ClientInit"},
                            {"tpl", tpl}
                        }));
                    }
    
                    comma = true;
                }
    
                if (!comma)
                {
                    return "";
                }
    
                sb.Append("}");
                return sb.ToString();
            }
    
            public virtual string ToName()
            {
                return this.CamelName ? this.Name.ToLowerCamelCase() : this.Name;
            }
        }
    
        /// <summary>
        /// 
        /// </summary>
        [Description("")]
        public partial class PropertyGridParameterCollection : BaseItemCollection<PropertyGridParameter>
        {
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            public PropertyGridParameter this[string name]
            {
                get 
                {
                    return GetParameterByName(name);
                }
            }
    
            private PropertyGridParameter GetParameterByName(string name)
            {
                foreach (PropertyGridParameter parameter in this)
                {
                    if (parameter.Name == name)
                    {
                        return parameter;
                    }
                }
    
                return null;
            }
    
            /// <summary>
            /// 
            /// </summary>
            [Description("")]
            public string Config()
            {
                return this.Config(false);
            }
    
            /// <summary>
            /// 
            /// </summary>
            /// <param name="dynamic"></param>
            [Description("")]
            public string Config(bool dynamic)
            {
                if (this.Count == 0)
                {
                    return "";
                }
    
                StringBuilder sb = new StringBuilder(256);
                sb.Append("{");
    
                foreach (PropertyGridParameter parameter in this)
                {
                    string config = parameter.ToConfig(dynamic);
                    
                    if (config.IsNotEmpty())
                    {
                        sb.Append(config.ConcatWith(","));
                    }
                }
    
                if (sb.Length <= 1)
                {
                    return "";
                }
    
                sb.Remove(sb.Length - 1, 1);
                sb.Append("}");
    
                return sb.ToString();
            }
    
            public string Source()
            {
                if (this.Count == 0)
                {
                    return "";
                }
    
                StringBuilder sb = new StringBuilder(256);
                sb.Append("{");
    
                foreach (PropertyGridParameter parameter in this)
                {
                    sb.Append(parameter.ToString().ConcatWith(","));
                }
    
                sb.Remove(sb.Length - 1, 1);
                sb.Append("}");
    
                return sb.ToString();
            }
        }
    }
  9. #9
    Hi Daniil

    I have rebuilt the Ext.NET with no errors but I get the same problem, the PropertyGridParameter editor is not showed, like stated in original post

    I have checked the ExtNet.dll assembly and is updated because haves 4 overloads for SetSource method (version 2.1.1 haves only 3 overloads).

    I have used the example code to test, the date, color and trigger PropertyGridParameters not show the editor (DateField, ComboBox and TriggerField)

        <ext:PropertyGrid 
                ID="PropertyGrid1" 
                runat="server" 
                Width="300"
                SortableColumns="false"
                ForceFit="true">
                <Source>
                    <ext:PropertyGridParameter Name="productionQuality" Value="false" Mode="Raw" />
                    <ext:PropertyGridParameter Name="created" Value="10/15/2006">
                        <Editor>
                            <ext:DateField runat="server" Format="MM/dd/yyyy" />
                        </Editor>
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="borderWidth" Value="5" Mode="Raw">
                        <Editor>
                            <ext:NumberField runat="server" />
                        </Editor>
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="color" DisplayName="Color" Value="Red">
                        <Editor>
                            <ext:ComboBox runat="server" ForceSelection="true">
                                <Items>
                                    <ext:ListItem Text="Red" /> 
                                    <ext:ListItem Text="Green" /> 
                                    <ext:ListItem Text="Blue" /> 
                                </Items>
                            </ext:ComboBox>
                        </Editor>
                        <Renderer Handler="return Ext.String.format('<span style=\'color: {0};\'>{1}</span>', value.toLowerCase(), value);" />
                    </ext:PropertyGridParameter>
                    <ext:PropertyGridParameter Name="trigger" Value="TriggerField" DisplayName="Trigger Field">
                        <Renderer Handler="metadata.tdCls = 'blue-label'; 
                                           return value;" />
                        <Editor>
                            <ext:TriggerField runat="server">
                                <Triggers>
                                    <ext:FieldTrigger Icon="SimpleEllipsis" Tag="ellipsis" />
                                </Triggers>
                                <Listeners>
                                    <TriggerClick Handler="#{PropertyGrid1}.editingPlugin.completeEdit(); 
                                                           Ext.Msg.alert('Trigger click', tag + ' trigger click');" />
                                </Listeners>
                            </ext:TriggerField>
                        </Editor>
                    </ext:PropertyGridParameter>
                </Source>
            </ext:PropertyGrid>
    Also I have tried to add a Ext:Parameter like below, and this PropertyGridParameter is not showed, with no exceptions or error messages:

    <ext:PropertyGridParameter Name="grouping" Value="false" Mode="Raw">
          <ext:Parameter Name="Some" Value="Data" />
    </ext:PropertyGridParameter>
    I can send you the re-compiled assembly, if you want to check something.

    Thanks in advance

    Horace
  10. #10
    Yes, please send the updated dll to daniil at ext.net.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Apr 19, 2012, 3:53 PM
  2. [CLOSED] PropertyGrid with combobox editor
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 14, 2012, 11:16 PM
  3. [CLOSED] PropertyGrid Combobox
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 27, 2011, 6:56 PM
  4. [CLOSED] Combobox in PropertyGrid
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 07, 2011, 4:19 PM
  5. Replies: 2
    Last Post: Apr 01, 2010, 2:20 PM

Tags for this Thread

Posting Permissions