radeditor Image manager folder name need to html decode

4 posts, 0 answers
  1. Sunil
    Sunil avatar
    10 posts
    Member since:
    Sep 2011

    Posted 03 Feb 2014 Link to this post

    Hello Team,

    I have used telerik rad editor in my application.

    In my application there are image library, audio library, video library.

    I have bound this library with rad editor image manager, video manager, media manager.
    (for e.g: used code for bind my library
     rtfEditor.ImageManager.ContentProviderTypeName = typeof(Telerik.ContentProvider.TelerikDBContentOfPhotoManager).AssemblyQualifiedName;
     rtfEditor.MediaManager.ContentProviderTypeName = typeof(Telerik.ContentProvider.TelerikDBContentOfMediaManager).AssemblyQualifiedName;
    rtfEditor.FlashManager.ContentProviderTypeName = typeof(Telerik.ContentProvider.TelerikDBContentOfFlashManager).AssemblyQualifiedName;
    )

    Above all functionality working fine.

    Now Problem is that in my database there are folder name or image gallery name or video gallery name is saved but when these folders is bind inside image manager / video manager / medai manager. it is not html decode to display folder or gallery name.

    For Example my folder name is <April's obra> inside database I have saved with HTML Encode and its "&lt;April&#39;s Obra&gt;"
    but I need to display "April's obra" in folder name.

    for other controls like rad grid its automatically HTML decoded.

    I have attached here screen shot for it.







  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 05 Feb 2014 Link to this post

    Hello Sunil,

    RadEditor is using RadFileExplorer to provide file browsing functionality for its dialogs and by default the control does manipulate the names of the items displayed inside its content.

    To handle this case, you need to modify the FileBrowser.ascx built in dialog and handle the RadFileExplorer's ExplorerPopulated event and manually decode the name of the items, e.g.:
    void explorer1_ExplorerPopulated(object sender, RadFileExplorerPopulatedEventArgs e)
    {
        foreach (var item in e.List)
        {
            item.Name = Server.HtmlDecode(item.Name);
        }
    }

    More detailed information on how to modify this built-in dialog is available in the following KB article:
    http://www.telerik.com/support/kb/aspnet-ajax/editor/details/displaying-single-upload-control-in-the-filebrowser-upload-manager

    I hope this helps.

    Regards,
    Dobromir
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. Sunil
    Sunil avatar
    10 posts
    Member since:
    Sep 2011

    Posted 07 Feb 2014 in reply to Dobromir Link to this post

    Hello Dobromir,

    Thanks for your help.

    I have already used External dialog ExternalDialogsPath="~/EditorDialogs" .

    And now I had used code suggest by you as below.

    <script runat="server" type="text/C#">    
        protected void RadFileExplorer1_ExplorerPopulated(object sender, RadFileExplorerPopulatedEventArgs e)
        {
            foreach (var item in e.List)
            {
                item.Name = Server.HtmlDecode(item.Name);
            }
        }
      
    </script>

     <telerik:RadFileExplorer ID="RadFileExplorer1" Height="400px" Width="400px" TreePaneWidth="150px"
                    runat="Server" EnableOpenFile="false" AllowPaging="true" PageSize="100" VisibleControls="TreeView,Grid"
                    OnClientFolderLoaded="OnClientFolderLoaded" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated" />


    but still not affect folder name.
    Also if I am trying to debug with break point it dont come to break point.

    Thanks 
    Sunil
  4. Vessy
    Admin
    Vessy avatar
    2418 posts

    Posted 11 Feb 2014 Link to this post

    Hello Sunil,

    Attaching a handler to a server event of a control, placed inside external dialog of RadEditor has to be done in the page load event of the custom user control. It cannot be attached directly through the FileExplorer's property:
    protected void Page_Load(object sender, System.EventArgs args)
    {
        Telerik.Web.UI.RadFileExplorer explorer = (Telerik.Web.UI.RadFileExplorer)this.FindRadControl(this.Page);
        if (explorer != null)
        {
            explorer.ExplorerPopulated += explorer_ExplorerPopulated;
        }
    }
     
    protected void explorer_ExplorerPopulated(object sender, Telerik.Web.UI.RadFileExplorerPopulatedEventArgs e)
    {
        foreach (var item in e.List)
        {
            item.Name = Server.HtmlDecode(item.Name);
        }
    }

    For your convenience I am attaching the modified project from the linked by my colleague Dobromir article, so you can examine it on your side.

    Regards,
    Veselina Raykova
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top