how to insert download link in rad Editor

2 posts, 1 answers
  1. Lwin phyo
    Lwin phyo avatar
    2 posts
    Member since:
    Jun 2013

    Posted 19 Jun 2013 Link to this post

    This is my code for rad Editor ,

    <telerik:RadEditor ID="RadEditor1Content" runat="server" AutoResizeHeight="True"
    Width="500px" ToolbarMode="Floating">
    <Content>
    </Content>
    <ImageManager EnableAsyncUpload="True" ViewPaths="~/images" UploadPaths="~/images" MaxUploadFileSize="900000000"/>
    <MediaManager EnableAsyncUpload="true" ViewPaths="~/media" UploadPaths="~/media"  MaxUploadFileSize="900000000"/>
    <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>

    When I insert video or song file using "MediaManager" , html view of rad Editor shows likes

    <object height="150" width="150" type="application/x-oleobject"
    classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6">
    <param name="URL" value="/media/MySongFile.mp3"><embed src="/media/MySongFile.mp3"
     type="application/x-mplayer2"
    pluginspage="http://www.microsoft.com/Windows/MediaPlayer" width="150" height="150">

    It shows my uploaded file(mp3) with MediaPlayer which can be play . I don't want to show likes this . I just want to show Download Link to download my uploaded file . How can I do that ?
  2. Answer
    Ivaylo
    Admin
    Ivaylo avatar
    37 posts

    Posted 20 Jun 2013 Link to this post

    Hello Lwin,

    Thank you for your question.

    The Editor does not support this functionality out-of-the-box and a custom implementation will be required to achieve the desired behavior.

    The following article in our online demo shows how a similar to the requested functionality can be accomplished by attaching to the OnClientPasteHtml event of the Editor: Editor - OnClientPasteHtml.

    In your scenario, by checking if the MediaManager command has fired the event, you will be able to get the HTML that would be pasted into the editor and edit it. You can, for example, capture the src attribute of the embed element (which would point to the uploaded file) and prepare an anchor tag with the same value for its href attribute. Finally, by firing args.set_value(div.innerHTML), you can paste into the editor the custom-made link.

    I hope that you will find the provided information helpful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Ivaylo
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top