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

5 posts, 0 answers
  1. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 22 Feb Link to this post

    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);
        }
    }

  2. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 22 Feb in reply to J Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 22 Feb Link to this post

    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.
  5. J
    J avatar
    30 posts
    Member since:
    Oct 2012

    Posted 22 Feb in reply to J Link to this post

    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.
  6. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 25 Feb Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017