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

Client-Side Methods?

30 Answers 868 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Shaun Peet
Top achievements
Rank 2
Shaun Peet asked on 20 Sep 2007, 04:54 AM
It's really confusing to see the official documentation for the Prometheus editor unchanged from the "old" editor.  The "new" documentation tells me that all of the old client-side methods are available (and don't follow ASP.NET AJAX naming conventions); but during debugging I can clearly see that none are available.  This is bad.  I really really need to fire up the Image Manager from outside the editor and in another thread (in the Futures forum) it was stated that this could be possible.  Here's hoping there's a way (now that I've changed my projects to use the new editor) to do this with the version released yesterday.

30 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 20 Sep 2007, 11:16 AM
Hi Shaun,

You can easily show the ImageManager or any other *Manager dialog without RadEditor, using the code below:
<div>
 <script type="text/javascript">
 function ImageManagerFunction(sender, args)
 {
  var selectedItem = args.SelectedItem;
  var resultImageObject = args.Result;
  
  alert("You selected " + selectedItem.GetPath());
  
  var txt = $get('<%= TextBox1.ClientID %>');
  txt.value = resultImageObject.outerHTML;
 }
 </script>
 <asp:scriptmanager id="ScriptManager1" runat="server" />
 <asp:textbox runat="server" id="TextBox1"></asp:textbox>
 <telerik:dialogopener runat="server" id="DialogOpener1">
 </telerik:dialogopener>
 <button onclick="$find('<%= DialogOpener1.ClientID %>').open('ImageManager');">
  Open ImageManager
 </button>
</div>

using Telerik.Web.UI;
using Telerik.Web.UI.Editor.DialogControls;

public partial class ImageManager_Default : System.Web.UI.Page
{
 protected void Page_Load(object sender, EventArgs e)
 {
  FileManagerDialogParameters dialogParameters = new FileManagerDialogParameters();
  dialogParameters.ViewPaths = new string[] { "~/" };
  dialogParameters.UploadPaths = new string[] { "~/" };
  dialogParameters.DeletePaths = new string[] { "~/" };
  dialogParameters.MaxUploadFileSize = 5000000;
  // If you don't set the following property, the default value will be used
  // dialogParameters.SearchPatterns = new string[] { "*.jpg" };

  DialogDefinition imageManager = new DialogDefinition(typeof(ImageManagerDialog), dialogParameters);
  imageManager.ClientCallbackFunction = "ImageManagerFunction";
  imageManager.Width = Unit.Pixel(694);
  imageManager.Height = Unit.Pixel(440);

  DialogOpener1.DialogDefinitions.Add("ImageManager", imageManager);
 }
}

Please, note that this is still undocumented functionality and could be a subject for changes, because we are still optimizing the API of the RadEditor dialogs.

Sincerely yours,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 20 Sep 2007, 02:12 PM
I like where this is going.  I'm one of the many people that have been asking for years to have the *Manager a separate control.  Can you confirm that you are planning on isolating the DialogOpener in the future, or is this just a quick fix?
0
Valeri Hristov
Telerik team
answered on 21 Sep 2007, 01:52 PM
The DialogOpener will be a part of RadControls. Most probably we will consider renaming the control to something like RadDialogOpener, but at the moment I cannot tell what will be the final name. It was introduced in RadSpell 3.0 and was improved in RadEditor Prometheus with the intention to become a separate control. Another still undocumented feature is the ability to put a dialog control like ImageManager directly on the page, without the need to open it in a dialog. This is also intended to become a part of the Prometheus package, but currently is under development and is a subject for changes.

Greetings,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
pucsoftware
Top achievements
Rank 1
answered on 07 Mar 2008, 04:54 PM
I am using the code in this example and have been getting an js error. I've narrowed it down to the following statement

alert("You selected " + selectedItem.GetPath());

It appears that the GetPath method of the selectedItem object does not exist. When I comment out this line, the code works - although I'd like to only have the name of the file returned rather than the image tag. I've looked all over for documentation on these client side objects and I can't find any reference to them. Can you tell me how I can get info on this object so I can get this to work properly. Also, any updates on a new component for just the Dialogs? To me this would be a very useful component! Thanks for your help.

Darren
0
Rumen
Telerik team
answered on 07 Mar 2008, 05:06 PM
Hi Darren,

The Telerik.Web.UI controls follow the MS AJAX code convention and their methods now start with small letters. You need to replace the selectedItem.GetPath() with selectedItem.getPath() and this will fix the JavaScript problem.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
bdk0172
Top achievements
Rank 1
answered on 14 Apr 2008, 07:53 PM
I've used the code from this post to bring up an ImageManager without using the radEditor control, but I'm having an issue of it being displayed under a radMenu control I also have on my page.  Is there anything that needs to be set to tell it to display on top of everything else on the page?  I'm using version 2008.1.325.20
0
Rumen
Telerik team
answered on 15 Apr 2008, 08:18 AM
Hi Brian,

The observed behavior is due to that the RadMenu control has a bigger z-index than RadWindow (used by RadEditor's dialogs). To fix the problem, decrease the z-index value of RadMenu by setting the style property for example to 10000, e.g.

<telerik:RadMenu style="z-index:10000" ID="RadMenu1" runat="server" Skin="Telerik">

In the official release of RadControls "Prometheus", scheduled for today, all controls will support the style="z-index: xxxx" property.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rumen
Telerik team
answered on 18 Apr 2008, 07:40 AM
Hi guys,

For your convenience, I have attached a sample working project that demonstrates how to use the Document manager of RadEditor for ASP.NET AJAX as a standalone control.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Marc-André Gendron
Top achievements
Rank 1
answered on 21 Apr 2008, 04:33 AM
Would it be possible to publish this code in VB.net as well? I need to use it but don't know C# very well at all.

Thank you,

Marc Gendron
0
Rumen
Telerik team
answered on 21 Apr 2008, 02:11 PM
Hi Marc-André,

My suggestion is to convert the C# code to VB.NET using our code convertor: http://converter.telerik.com. Please, let me know if you experience any problems and I will be glad to help.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Devlan
Top achievements
Rank 1
answered on 23 Apr 2008, 12:28 AM
this is really cool being able to use the dialogs outside of the editor.

when i use the ImageManagerDialog, the incredibly great "Image Editor" button is there, but when i click on it, i get an error:

    "'this.get_editor()' is null or not an obect"

it is trying to find an ImageEditorDialog or a RadEditor?

i've managed to add the ImageEditorDialog to a page and can open it manually. but i'm having trouble getting the two to link up.
0
Lini
Telerik team
answered on 24 Apr 2008, 03:43 PM
Hello,

I think that this is a bug in our code. The Image Editor should be available outside the editor as well. I will log this in the bug tracker and I hope that we will manage to fix it in time for the service pack release in mid-May.

Best wishes,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Aleksandr
Top achievements
Rank 1
answered on 24 Apr 2008, 10:03 PM
Code works great in IE; however in firefox I get the following error message:

"Web.config registration missing!
    The Telerik dialogs require a HttpHandler..."
0
Marc-André Gendron
Top achievements
Rank 1
answered on 24 Apr 2008, 10:05 PM
I face the same issue as described above. The file managers works well as part of the Editor, but fails to show up in Firefox when used with the code that you provided.

Marc
0
Rumen
Telerik team
answered on 25 Apr 2008, 10:57 AM
Hi guys,

Here is an example how to correct the code to work in IE and Firefox:

<script type="text/javascript">
 function DocumentManagerFunction(sender, args)
 {
  var selectedItem = args.SelectedItem;
  var resultDocumentObject = args.Result;
 
  alert("You selected " + selectedItem.getPath());
 
  var txt = $get('<%= TextBox1.ClientID %>');
 
  txt.value = resultDocumentObject.pathname;
 }
 </script>
 <asp:textbox runat="server" id="TextBox1"></asp:textbox>
 <telerik:dialogopener runat="server" id="DialogOpener1">
 </telerik:dialogopener>
 <button onclick="$find('<%= DialogOpener1.ClientID %>').open('DocumentManager');return false;">
  Open Document Manager
 </button>

You need to set return false after the open method in the onclick event of the button tag as well as replace resultDocumentObject.outerHTML with resultDocumentObject.pathname.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
shimmy
Top achievements
Rank 1
answered on 18 Jul 2008, 03:55 PM
Hi guys,

I have a quick questions regarding to this feature, I mange to open up the image manager, store image and retrieve the path using the javascript.

However i'm having problem trying to retrieve the alt text.  Is there a javascript command for this? just like getPath() method?

thank you
0
Rumen
Telerik team
answered on 22 Jul 2008, 06:43 AM
Hi Shimmy,

You can get the alt attribute information from the resultImageObject object with the following code:

resultImageObject.alt

or

args.Result.alt

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kenneth
Top achievements
Rank 1
answered on 07 Aug 2008, 03:35 PM

I would like to use the "LinkManager" dialog as a standalond, just like this thread regarding the ImageManager.

I followed the instructions here and it will display the link manager but I get a javascript error, saying realLink is null. realLink is a child of _clientParameters.

I presume there is a probably with initializing some element of the dialog. Is there some way to work around this?

Thanks.

0
Rumen
Telerik team
answered on 08 Aug 2008, 09:47 AM
Hi Kenneth,

Due to the multiple customers' requests we provided the ability to use the Image and Document managers as standalone controls. However the rest of the editor's dialogs are tidily integrated with RadEditor and they cannot be used without RadEditor.

Currently, it is not possible to use the rest of the dialogs separately, but if more people request this feature we will consider implementing it.


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shaun Peet
Top achievements
Rank 2
answered on 11 Aug 2008, 03:21 AM
Just as an FYI, I've submitted a new project to the code library that demonstrates how to use all the File Managers as stand-alone controls.  If the other dialogs become available as stand-alone controls I will add them to that project as well.

http://www.telerik.com/community/code-library/submission/b311D-bkkaek.aspx

0
Rumen
Telerik team
answered on 11 Aug 2008, 07:11 AM
Hi Shaun,

Thank you for the code library project!

I just want to add that there is a KB article on the subject: Using the Image and Document managers outside RadEditor, which provides additional guidance how to configure and use the Image Editor dialog from the standalone Image Manager.


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shaun Peet
Top achievements
Rank 2
answered on 11 Aug 2008, 02:03 PM
You know, I thought there had to be something somewhere by you guys but I couldn't remember where / what it was.  Oh well, now it's in both places and I'll update the code library project as other dialogs become available.  Looks like I'm already missing the ImageEditor?
0
Rumen
Telerik team
answered on 11 Aug 2008, 02:31 PM
Hi Shaun,

Your project is great and to complete it you should add only the code for using the Image Editor. I will notify you if we provide support for using new dialogs as standalone so that you can update the project.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marcus Eddy
Top achievements
Rank 1
answered on 19 Apr 2009, 03:20 PM
Hi All

Has there been any progress since the last post regarding using other dialogs outside of the radeditor (namely the link manager mentioned above)?

If not please take this a request to add to your list of others wanting this facility

Cheers Marcus
0
Tervel
Telerik team
answered on 21 Apr 2009, 07:30 AM
Hello Marcus,

Please examine the following online demo:
http://demos.telerik.com/aspnet-ajax/editor/examples/externaldialogspath/defaultcs.aspx


Best wishes,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Marcus Eddy
Top achievements
Rank 1
answered on 21 Apr 2009, 08:26 AM
Hi Tervel

I was more referring to using the link manager stand alone in the same way as the following

http://www.telerik.com/support/kb/aspnet-ajax/editor/using-the-image-and-document-managers-outside-radeditor.aspx 

rather than still have to use the radeditor at all.  The link you provided only has customizing the dialogs but they are still used within the radeditor.

regards marcus
0
Tervel
Telerik team
answered on 21 Apr 2009, 11:13 AM
Hello Marcus,

I see your point. Yes, we still have plans to expose the ability to call editor dialogs, and we even wanted to do it for Q1 2009. We did manage to streamline the client-side mechanism for exchanging arguments from dialog to the main page. We also did some work on the RadDialogOpener and exposed it as a public class. However, this effort was not fully completed because the RadFileExplorer control - which is related to the DialogOpener, yet released as an independent control - was with a higher priority.

What needs to be done is to provide declarative support to the RadDialogOpener's DialogDefinitions. I strongly hope that we will manage to squeeze that in for the Q2 2009 as most of the things have alerady been done. However, please note that the priority of this functionality is not as high as with other requested features.


All the best,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dane
Top achievements
Rank 1
answered on 17 Jun 2009, 09:35 AM
Hi Guys,

I have been having issues getting the stand alone image lib working from fire fox.
I have come to discover that it's being caused by the jquery syntax for getting elements. ($find, $get, etc)

I have recently been working on a site with a rather templated layout which required that i set multiple images from the standlone image library, below is my solution:

////////////// Dialogue Manager + Scripts \\\\\\\\\\\\\\\\\\\\\\

<telerik:dialogopener runat="server" id="DialogOpener1" ></telerik:dialogopener>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
    var BannerID;
    var lblBanner;
    //<![CDATA[
    function ImageManagerFunction(sender, args) {
        var selectedItem = args.get_value();
        var Image = document.getElementById(BannerID);
        var lbl = document.getElementById(lblBanner);
        var path = args.value.getAttribute("src", 2);        
        path = path.substring(path.lastIndexOf("ImageLibrary/") + 13, path.length);
        if ($telerik.isIE) {
            alert("dd");
            Image.value = "~/ImageLibrary/" + path  //this is the selected IMG tag element
            lbl.src = "<%= ConfigurationManager.AppSettings["ApplicationURL"].ToString() %>ImageLibrary/" + path;
        }
        else {
            Image.value = "~/ImageLibrary/" + path  //this is the selected IMG tag element
            lbl.src = "<%= ConfigurationManager.AppSettings["ApplicationURL"].ToString() %>ImageLibrary/" + path
        }
    }
    function ShowImageLib(field, label) {
        BannerID = field;
        lblBanner = label;
        $find('<%= DialogOpener1.ClientID %>').open('ImageManager', { CssClasses: [] });
        return false;

    }
    
    function openWin(what, name) {
        var oWnd = radopen(what, name);
    }

    //]]>

    
</script> </telerik:RadScriptBlock>

////////////////////////////////// Call from page \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
<table cellpadding="5" cellspacing="0">
        <tr>
            <td><b>Banner</b>
            <br /><asp:HiddenField id="imgPath" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.Image") %>'/><asp:Image ID="imgPreview" runat="server" ImageUrl='<%# GetImage(DataBinder.Eval(Container, "DataItem.Image")) %>' /></td>
        </tr>
        <tr>
            <td style="text-align:right;"><a href="#" onclick="javascript: ShowImageLib('<%= imgPath.ClientID %>', '<%= imgPreview.ClientID %>');">Choose Image</a></td>
        </tr>
        </table>

Hope this helps anyone who experianced the same issues.
Dane


0
Tervel
Telerik team
answered on 17 Jun 2009, 12:57 PM
Hi Dane,

Thank you for the posted code. I just wish to add a small correction for people reading your post:
$get and $find methods are not related to jQuery. These are standard methods in ASP.NET AJAX framework and have been provided/implemented by Microsoft (and they do work correctly).

Greetings,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dane
Top achievements
Rank 1
answered on 17 Jun 2009, 01:30 PM
Thanks Tervel,

Those methods were what was causing my issues in Fire Fox.
Changing $get to document.getelementbyid() resolved all my issues.

thanks
Dane
Tags
Editor
Asked by
Shaun Peet
Top achievements
Rank 2
Answers by
Valeri Hristov
Telerik team
Shaun Peet
Top achievements
Rank 2
pucsoftware
Top achievements
Rank 1
Rumen
Telerik team
bdk0172
Top achievements
Rank 1
Marc-André Gendron
Top achievements
Rank 1
Devlan
Top achievements
Rank 1
Lini
Telerik team
Aleksandr
Top achievements
Rank 1
shimmy
Top achievements
Rank 1
Kenneth
Top achievements
Rank 1
Marcus Eddy
Top achievements
Rank 1
Tervel
Telerik team
Dane
Top achievements
Rank 1
Share this question
or