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

how to insert download link in rad Editor

1 Answer 87 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lwin phyo
Top achievements
Rank 1
Lwin phyo asked on 20 Jun 2013, 04:31 AM
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 ?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivaylo
Telerik team
answered on 20 Jun 2013, 02:20 PM
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.
Tags
Editor
Asked by
Lwin phyo
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Share this question
or