RadFilterDropDownEditor problem

4 posts, 1 answers
  1. Barbaros Saglamtimur
    Barbaros Saglamtimur avatar
    110 posts
    Member since:
    Jul 2012

    Posted 27 May 2011 Link to this post

    Hi,

    I found some samples about RadFilterDropDownEditor like:
    public class RadFilterDropDownEditor : RadFilterDataFieldEditor
    {
        protected override void CopySettings(RadFilterDataFieldEditor baseEditor)
        {
            base.CopySettings(baseEditor);
            var editor = baseEditor as RadFilterDropDownEditor;
            if (editor != null)
            {
                DataSourceID = editor.DataSourceID;
                DataTextField = editor.DataTextField;
                DataValueField = editor.DataValueField;
            }
        }
     
        public override System.Collections.ArrayList ExtractValues()
        {
            ArrayList list = new ArrayList();
            list.Add(_combo.SelectedValue);
            return list;
        }
     
        public override void InitializeEditor(System.Web.UI.Control container)
        {
            _combo = new RadComboBox();
     
            _combo.DataTextField = DataTextField;
            _combo.DataValueField = DataValueField;
            _combo.DataSourceID = DataSourceID;
     
            container.Controls.Add(_combo);
        }
     
     
        public override void SetEditorValues(System.Collections.ArrayList values)
        {
            if (values != null && values.Count > 0)
            {
                if (values[0] == null)
                    return;
                var item = _combo.FindItemByValue(values[0].ToString());
                if (item != null)
                    item.Selected = true;
            }
        }
     
        public string DataTextField
        {
            get
            {
                return (string)ViewState["DataTextField"] ?? string.Empty;
            }
            set
            {
                ViewState["DataTextField"] = value;
            }
        }
        public string DataValueField
        {
            get
            {
                return (string)ViewState["DataValueField"] ?? string.Empty;
            }
            set
            {
                ViewState["DataValueField"] = value;
            }
        }
        public string DataSourceID
        {
            get
            {
                return (string)ViewState["DataSourceID"] ?? string.Empty;
            }
            set
            {
                ViewState["DataSourceID"] = value;
            }
        }
        private RadComboBox _combo;
    }

    But I faced 2 problems.
    1-When I try to set its DataType to System.Int32, I receive "Input string was not in a correct format." error. But when I set it to System.String it works. (the result is = '1' -within single quotas- as expected as it is set to be string). I have checked DataTextField and DataValueField properties and they are referencing to proper fields and datatypes.

    2-When I set its value from combobox and add another condition/expression it looses it value and select first value of the combobox.

    Any thoughts?

    Thanks in advance.
  2. Answer
    Mira
    Admin
    Mira avatar
    1124 posts

    Posted 30 May 2011 Link to this post

    Hello Barbaros,

    I tried to replicate the issue which you described, but to no avail.
    Attached to this message, you will find the code which I used for testing.

    Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

    Best wishes,
    Mira
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Barbaros Saglamtimur
    Barbaros Saglamtimur avatar
    110 posts
    Member since:
    Jul 2012

    Posted 02 Jun 2011 Link to this post

    Thanks for your reply. This is interesting: If I set DataSourceId property to an EntityDataSource I face problems as mentioned. But if I use DataSource property as in your example and use DataTable everything works as expected.
  5. Raji
    Raji avatar
    56 posts
    Member since:
    Jul 2011

    Posted 21 Jul 2011 Link to this post

    Hi,

    Iam using VS2005 and .Net 2.0. I just wanted to know if the RadFilterDropDownEditor code is going to work. I tried to run but the drop down is not showing up. To make it run what I should be doing.

    Thanks,
    Raji
Back to Top