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

Custom link dialog: problem editing existing link

1 Answer 14 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Marja
Top achievements
Rank 1
Marja asked on 04 Dec 2013, 06:07 PM
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?


1 Answer, 1 is accepted

Sort by
0
Accepted
Ianko
Telerik team
answered on 09 Dec 2013, 07:47 AM
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.
Tags
Editor
Asked by
Marja
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or