Custom link dialog: problem editing existing link

2 posts, 1 answers
  1. Marja
    Marja avatar
    70 posts
    Member since:
    Nov 2013

    Posted 04 Dec 2013 Link to this post

    Hi,

    I'm trying to build my own custom 'insert/edit link' dialog, following the example found at http://demos.telerik.com/aspnet-ajax/editor/examples/customdialogs/defaultvb.aspx

    If an existing internal link was selected to be edited, eg. a link to a named anchor, the RadEditor returns a 'href' attribute including the URL of the current page.
    Eg. when the link to be edited is "<a href="#Marja">Jump to Marja</a>", I get "http://localhost:55098/wsAdmin/TestRadEditor.aspx#Marja" as value for the 'href' attribute instead of merely "#Marja".

    What can I do about this?


  2. Answer
    Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 09 Dec 2013 Link to this post

    Hi Marja,

    The problem is due to JavaScript behavior. When the HREF attribute is retrieved via the href property, the returned value is an absolute path. I suggest using the getAttribute() method, which will get the original string value of the desired attribute.

    You can replace the initDialog() method of the dialog with this example one:
    function initDialog()
            {
                var clientParameters = getRadWindow().ClientParameters;
                linkUrl.value = clientParameters.getAttribute("href");
                linkTarget.value = clientParameters.target;
                linkClass.value = clientParameters.className;
                linkName.value = clientParameters.innerHTML;
     
                workLink = clientParameters;
            }


    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top