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

[Solved] Loading a document from code behind

4 Answers 186 Views
Editor
This is a migrated thread and some comments may be shown as answers.
pmoney pmoney
Top achievements
Rank 1
pmoney pmoney asked on 22 Dec 2009, 05:15 PM
Does the Editor have a load or an open function that I can call to open a file in the editor text area???
I would like to know how to do it from the cobe behind but javascript will help also.
Please help!

4 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 22 Dec 2009, 09:37 PM
I believe the only way to approach this is to convert the text you are attempting to load into valid HTML and then use the set_html client-side function or the "Content" attribute on the server-side. From what I know there is no way of loading a document (assuming you mean .txt or .docx etc.) into the RadEditor out-of-the-box.
0
pmoney pmoney
Top achievements
Rank 1
answered on 22 Dec 2009, 10:47 PM
One more question....
Is there a way to set the upload path according to the users id for example?
That way other users won't be able to see other files not in thier directory?

Uploads/users/1020(userid)
0
Accepted
Rumen
Telerik team
answered on 23 Dec 2009, 08:51 AM
Hi,

You can see how to load an HTML file in RadEditor in this example: Save In External File.

As to the second question: It is standard practice to have your users' IDs stored in a database of your CMS, and create a specific folder for each user when a user account is created. Then, when a user is logged and wishes to use the editor, setting the user's folder for this particular logged user is a matter of a single line of code, such as

  RadEditor1.ImageManager.ViewPaths = New String() {"~/Images/" + LOGGEDUSERID }
RadEditor1.ImageManager.UploadPaths = New String() {"~/Images/" + LOGGEDUSERID }

Thus each user will have access only to his/her folder, and be able to do whatever you let them do, without interfering with other users (and yes, if you have 100 users you will need to create 100 folders).

The only other way is for you to implement your own image manager with your own security and user authentication/authorization that handles your custom logic of determining and distinguishing what user uploaded what file, and what user has the right to delete what file.

Best wishes,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
pmoney pmoney
Top achievements
Rank 1
answered on 23 Dec 2009, 03:11 PM
Thanks ah bunch for your help! :)
Tags
Editor
Asked by
pmoney pmoney
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
pmoney pmoney
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or