This is a migrated thread and some comments may be shown as answers.

RadFilterDropDownEditor problem

3 Answers 101 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Barbaros Saglamtimur
Top achievements
Rank 1
Barbaros Saglamtimur asked on 27 May 2011, 02:47 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Mira
Telerik team
answered on 30 May 2011, 09:39 AM
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.

0
Barbaros Saglamtimur
Top achievements
Rank 1
answered on 02 Jun 2011, 09:25 AM
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.
0
Raji
Top achievements
Rank 1
answered on 21 Jul 2011, 07:44 PM
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
Tags
Filter
Asked by
Barbaros Saglamtimur
Top achievements
Rank 1
Answers by
Mira
Telerik team
Barbaros Saglamtimur
Top achievements
Rank 1
Raji
Top achievements
Rank 1
Share this question
or