Client-Side Methods?

31 posts, 0 answers
  1. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 19 Sep 2007 Link to this post

    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.
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 20 Sep 2007 Link to this post

    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
  3. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 20 Sep 2007 Link to this post

    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?
  4. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 21 Sep 2007 Link to this post

    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
  5. pucsoftware
    pucsoftware avatar
    24 posts
    Member since:
    Sep 2006

    Posted 07 Mar 2008 Link to this post

    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
  6. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 07 Mar 2008 Link to this post

    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
  7. bdk0172
    bdk0172 avatar
    50 posts
    Member since:
    Oct 2006

    Posted 14 Apr 2008 Link to this post

    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
  8. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 15 Apr 2008 Link to this post

    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
  9. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 18 Apr 2008 Link to this post

    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
  10. Marc-André Gendron
    Marc-André Gendron avatar
    3 posts
    Member since:
    Apr 2008

    Posted 20 Apr 2008 Link to this post

    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
  11. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 21 Apr 2008 Link to this post

    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
  12. Devlan
    Devlan avatar
    7 posts
    Member since:
    Apr 2008

    Posted 22 Apr 2008 Link to this post

    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.
  13. Lini
    Admin
    Lini avatar
    2146 posts

    Posted 24 Apr 2008 Link to this post

    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
  14. Aleksandr
    Aleksandr avatar
    1 posts
    Member since:
    Apr 2008

    Posted 24 Apr 2008 Link to this post

    Code works great in IE; however in firefox I get the following error message:

    "Web.config registration missing!
        The Telerik dialogs require a HttpHandler..."
  15. Marc-André Gendron
    Marc-André Gendron avatar
    3 posts
    Member since:
    Apr 2008

    Posted 24 Apr 2008 Link to this post

    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
  16. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 25 Apr 2008 Link to this post

    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
  17. shimmy
    shimmy avatar
    3 posts
    Member since:
    Jul 2008

    Posted 18 Jul 2008 Link to this post

    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
  18. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 22 Jul 2008 Link to this post

    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
  19. Kenneth
    Kenneth avatar
    70 posts
    Member since:
    Feb 2008

    Posted 07 Aug 2008 Link to this post

    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.

  20. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 08 Aug 2008 Link to this post

    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.
  21. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 10 Aug 2008 Link to this post

    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

  22. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 11 Aug 2008 Link to this post

    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.
  23. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 11 Aug 2008 Link to this post

    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?
  24. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 11 Aug 2008 Link to this post

    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.
  25. Marcus Eddy
    Marcus Eddy avatar
    26 posts
    Member since:
    Jun 2008

    Posted 19 Apr 2009 Link to this post

    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
  26. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Apr 2009 Link to this post

    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.
  27. Marcus Eddy
    Marcus Eddy avatar
    26 posts
    Member since:
    Jun 2008

    Posted 21 Apr 2009 Link to this post

    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
  28. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Apr 2009 Link to this post

    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.
  29. Dane
    Dane avatar
    5 posts
    Member since:
    Aug 2012

    Posted 17 Jun 2009 Link to this post

    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


  30. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 17 Jun 2009 Link to this post

    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.
Back to Top