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

How do I set the data source for built in field editors?

4 Answers 86 Views
Filter
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 22 Feb 2016, 07:17 PM

Specifically a RadFilterDropDownEditor, but I will also need date editors as well. I can't find any good documentation explaining how to set something up. My current strategy is based off of the code here: http://docs.telerik.com/devtools/aspnet-ajax/controls/filter/field-editors/programmatic-creation. I have to set the field editor's values with a list, but using the code below, there are no values in the drop down. I have also seen the code here but it is a completely different and unexplained approach, and involving data tables is, in my opinion, bad.

 

Here is essentially what I have:

<telerik:RadFilter runat="server" ID="rfFilter" RenderMode="Lightweight" FilterContainerID="RadGrid1" ShowApplyButton="False" ViewStateMode="Enabled" OnApplyExpressions="rfFilter_ApplyExpressions"/>

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadFilterDropDownEditor districtFilter = new RadFilterDropDownEditor();
        rfFilter.FieldEditors.Add(districtFilter);
        statusFilter.FieldName = "District";
        statusFilter.DataType = typeof(string);
 
        var list = new ArrayList(GetDistrictList());
        statusFilter.SetEditorValues(list);
    }
}

4 Answers, 1 is accepted

Sort by
0
J
Top achievements
Rank 1
answered on 22 Feb 2016, 08:36 PM
I went ahead and mindlessly followed the other approach with the DataTable and it works, but is there another way? I do not like having a DataTable in my codebehind, and I do not like how often the DataTable creation code gets executed.
0
J
Top achievements
Rank 1
answered on 22 Feb 2016, 09:10 PM
Why is ExpressionItemCreated called so often? I'm seeing it get called on page load, when an expression is added, when the expression field is changed, and of most concern, it gets called when I DELETE an expression. ExpressionItemCreated gets called when I delete an expression. How does that make sense? This is another reason I need an alternative. I'm creating data tables left and right, and it makes the page unbearably slow.
0
J
Top achievements
Rank 1
answered on 22 Feb 2016, 09:29 PM
OK I realized the data source doesn't need to be a data table, so performance has improved a little, but I am still looking for an alternative to this (http://demos.telerik.com/aspnet-ajax/filter/examples/field-editors/defaultcs.aspx) method because the editor values come from a stored procedure, and opening a connection and executing the procedure is expensive.
0
Kostadin
Telerik team
answered on 25 Feb 2016, 12:56 PM
Hi,

Please check out the attached sample where I demonstrates how to populate the DropDownList with an ArrayList. In case your scenario differs I would appreciate if you can replicate the issue in my sample or send a runnable one to examine it locally.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Filter
Asked by
J
Top achievements
Rank 1
Answers by
J
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or