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

ImageManager find value to use as custom path

3 Answers 93 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 20 Jul 2008, 06:13 PM
Hi,

I searching solution to read a textbox value from Page and use to set the path of ImageManager. I tried with javascripting and I'm be abble to read and sent the value in input hidden but not to retrieve in the codebehind. Object : create specific folders using the value added by user.

Reading the value from textBox

var

mytitle = document.getElementById("ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_Title").value;

var myauthor = document.getElementsByName("ctl00$ContentPlaceHolder1$contolPanel$ctl00$ctl00$editMetaFields$ctl00$Author")[0].value;

Passing to my input hidden

<

input id="myval1" type="hidden" runat="server" enableviewstate="true" />

document.getElementById("ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_editMetaFields_ctl00_Image2_myval1").value=mytitle;

document.getElementById(

"ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_editMetaFields_ctl00_Image2_myval2").value=myauthor;

Retrievin as Codebehind : NO WORKING
1/ Directly in Load_Page : No Value found
string folder1 = myval1.Value;
string folder2 = myval2.Value;
2/ No found
string folder1 = webBrowser1.Document.GetElementById("myval1").InnerText;
3/ If (!PostBack) No found
4/ Request Form Not accepted by my sol need web.config
string folder1 = Request.Form["myval1"];

It's possible to define the ImageManager path in javascripting to use my value ?.
Other solution to pass one value from TextBox in Page to ImageManager ?.
Nobody send value from javascript to codebehind?

Any help are welcome, Regards.


3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 24 Jul 2008, 11:51 AM
Hi Pierre,

If you want to set the ViewPaths of the Image manager on the client - this is not supported. However, if you would like to load the image in the Image dialog and to select it you should supply an extra querystring parameter named PreselectedItemUrl having a value the image src path, e.g.

var selectedElement = image ;//set the image object from the textbox here
var dialogOpener = $find("DialogOpener1");
if (selectedElement && selectedElement.tagName.toLowerCase() == "img";-)
{
    dialogOpener.set_additionalQueryString("&PreselectedItemUrl=" + encodeURIComponent(selectedElement.src));
}

editor.showDialog("ImageManager", null, callbackFunction);
dialogOpener.set_additionalQueryString(oldAdditionalQueryString);

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pierre
Top achievements
Rank 1
answered on 24 Jul 2008, 01:54 PM
Hi Rumen,

Thanks for this Tips, I can use for others solution, but for my problem I can't use.
I searching to create folders from my cms. To make I use 2 TextBox controls and catch the value using javascript, but I haven't solution to send in the ImageManager these value to define my userfolders in ImageManager.
I have tried with input hidden and Send buttons,  The values are in the page innerHTML by javascripting, but I can't catch to use in the ImageManager.
The Page is one MasterPage with 2 Webcontrols. The TextBox are in one and the imageManager are the second. I have tested with another sample send by Sophy ( 2 Webcontrols inside one masterPage and send button, the value are passed from TextBox (UC1)to Labels(UC2) with success but unable to use in the ImageManager codebehind(UC2)).

Obj: folder1 and folder2 (user by type in TextBox)
dialogParameters1.ViewPaths = new string[] { "~/contents/member/" + Username + "/" + folder1 + "/" + folder2 };

Could you try other solution?. I have posted as ticket in Sitefinity could you speak about to help me plz.

Regards
0
Tervel
Telerik team
answered on 30 Jul 2008, 11:19 AM
Hello Pierre,

In case you try to configure the ImageManager on the client-side using javascript - please note that this is not possible.

For security reasons, to avoid unauthorized access to forbidden folders by malicious users, the ImageManager can only be configured from the server -side using the editor's server API.

We are still not sure what your scenario is, but in case you implement the folder creation and sending of the information properly (this task is not related to RadEditor), then configuring the ImageManager on the server is a straightforward task.

In case we understand your scenario correctly, you should use postback or AJAX to send the values of the hidden fields on the server, then create folders with the requested names, then configure the editor's image paths, and reload your page.

This is a complex scenario that involves server-side actions, and is not possible to achieve solely throught javascript on the client.

Greetings,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Pierre
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Pierre
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or