Detect editor ID in managers

7 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 20 Oct 2010 Link to this post

    Hi,

    I use a customized Linkmanager.ascx

    How can I detect in the Linkmanager.ascx which editor openened the Linkmanager when there are multiple RadEditors on the page?

    BR
    Marc
  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 22 Oct 2010 Link to this post

    Hi Marc,

    Steps to achieve the requested feature:
    1) Default.aspx:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad" ExternalDialogsPath="~/EditorDialogs"></telerik:RadEditor>
    <script type="text/javascript">
        var editorObject = null;
        function OnClientLoad(editor) {
            editorObject = editor;
        }
     
        function invokeTopPageMethod(fileName) {
            alert("The RadEditor's ID is " + editorObject.get_id());
        }
    </script>

    2) LinkManager.ascx:
    Put at the end of the file the following function:

    <script type="text/javascript">
        function pageLoad() {
            window.top.invokeTopPageMethod();
        }
    </script>

    window.top is used to access a method from the parent page from the iframe based dialog of RadEditor.

    Greetings,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 25 Oct 2010 Link to this post

    Hi Rumen,

    Your code is not working where there are multiple editors on the page.

    I achieved the desired functionality with
    clientInit: function(clientParameters)
    {
    this._clientParameters = clientParameters;
                         
    var editor = this._clientParameters.editor;
    alert(editor.get_id())

    I copied this from FindAndReplace,ascx.
    This gives me the correct sender for every Editor instance on the page.


    EDIT: This is even mentioned in the LinkManager file itself:
    //Editor object is supplied to all dialogs in the dialog parameters
    var editor = this._clientParameters.editor;
    Sorry I didn't discover this earlier.


    Regards,
    Marc
  5. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 25 Oct 2010 Link to this post

    Hi Rumen,

    I am still working on this issue.

    What I am initially trying is to detect a language value from the editor in the LinkManager.ascx

    I saw that there is a common way to send an extra parameter to the dialog, I think this is a good way of achieving the desired functionality:
    http://www.telerik.com/community/forums/aspnet-ajax/editor/add-query-string-to-telerik-web-ui-dialoghandler-aspx.aspx

    When I try so I get the following error message:

    Invalid length for a Base-64 char array.

    [FormatException: Invalid length for a Base-64 char array.]
       System.Convert.FromBase64String(String s) +0
       Telerik.Web.UI.Common.XorCrypter.Decrypt(String encoded, String key) +30
       Telerik.Web.UI.DialogHandlerNoSession.get_DialogParametersProviderTypeName() +61
       Telerik.Web.UI.DialogHandlerNoSession.get_DialogParametersProviderType() +13
       Telerik.Web.UI.DialogHandlerNoSession.CreateChildControls() +159
       System.Web.UI.Adapters.ControlAdapter.CreateChildControls() +15
       System.Web.UI.Control.EnsureChildControls() +128
       Telerik.Web.UI.DialogHandlerNoSession.OnPreLoad(EventArgs e) +18
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +554
    


    Any ideas what could cause this?

     Regards,
    Marc
  6. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 25 Oct 2010 Link to this post

    Hi Fit2Page,

    Do you use some other encoding for your page than UTF-8? If this is the case I suggest to change it to UTF-8 and run the Spell Check to see if this helps. Here is a forum thread discussing the encoding issues with the Spell Check:

    http://www.telerik.com/community/forums/aspnet-ajax/editor/spell-check-handler-server-error-500-invalid-length-for-a-base-64-char-array.aspx

    This problem is fixed in the Q3 2010 Beta build of RadControls for ASP.NET AJAX and will not exist in the official Q3 2010 build, which is scheduled for 10th of November:

    What’s Fixed

    • Fixed: System.FormatException: Invalid length for a Base-64 char array sometimes raised for non-unicode websites under .NET 2.0


    Regards,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 25 Oct 2010 Link to this post

    Note that I try to get the additional parameter to the LinkManager dialog.

    I am using UTF-8 that is not the problem.

    I am trying to send from code behind:

    Dim byt As Byte() = System.Text.Encoding.UTF8.GetBytes("NL")
    editor_Text.DialogOpener.AdditionalQueryString = Convert.ToBase64String(byt)


    That fails with the Base 64 error

    When I send from client side it works with:

    editor.get_dialogOpener().set_additionalQueryString("&Taal=NL");

    Do you have a clue why the server site approach won't work?

    Marc
  8. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 26 Oct 2010 Link to this post

    Hello Marc,

    Our recommendation is to not encode the URL string with Convert.ToBase64String method because it could contains the + and = symbols, which are reserved symbols for the URL querystring and the RadEditor's dialog URL already contains them.

    All the best,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017