Property display name

2 posts, 0 answers
  1. Andrea
    Andrea avatar
    61 posts
    Member since:
    Oct 2012

    Posted 07 Sep Link to this post

    Hello, does anyone knows a way to let the RadDataFilter to show the "DisplayName" of a property (as taken from a resource file) instead of the property name in unbound mode so that I do not have to write my own parser to convert the expression between "display" and "property" ?

    [Display(Name = "DATAARR_DisplayProp", Description="DATAARR_zz_tooltip_", ResourceType=typeof(Warehouse.Magany2.loc.PKLIST_LOCALI))]       
    public Nullable<DateTime> DATAARR      
    {  
       get;
       set;
    }
        

     

    See attached image

    Best Regards

    Andrea

  2. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 08 Sep Link to this post

    Hi Andrea,

    Such attributes are not supported. However, you can manually change the text in the editor and in the node. Here is an example for this:
    //change in drop down
    private void RadDataFilter1_EditorInitialized(object sender, TreeNodeEditorInitializedEventArgs e)
    {
        var editor = e.Editor as TreeViewDropDownListEditor;
        if (editor != null)
        {
            var element = editor.EditorElement as BaseDropDownListEditorElement;
            element.ListElement.VisualItemFormatting -= ListElement_VisualItemFormatting;
            element.ListElement.VisualItemFormatting += ListElement_VisualItemFormatting;
        }
    }
     
    private void ListElement_VisualItemFormatting(object sender, VisualItemFormattingEventArgs args)
    {
        if (args.VisualItem.Text == "Name")
        {
            args.VisualItem.Text = "Custom Text";
        }
    }
    //change in text
    private void RadDataFilter1_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e)
    {
        DataFilterCriteriaElement dataGroupFilterElement = e.NodeElement as DataFilterCriteriaElement;
        if (dataGroupFilterElement != null  )
        {
            if (dataGroupFilterElement.FieldElement.Text == "Name")
            {
                dataGroupFilterElement.FieldElement.Text = "Custom Text";
            }
            
        }
        
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top