Custom Dialog Links

3 posts, 0 answers
  1. Peter Bulloch
    Peter Bulloch avatar
    13 posts
    Member since:
    Mar 2010

    Posted 28 Aug 2013 Link to this post

    Greetings, using the sample found here
    We have been able to add custom links to our HTML content. 

    The problem is, if our link has any other formatting (bold or italics is clicked) , the sample script will not pickup the link applied and will not return  the already set href.  It has something to do with the nested tags.  For example, this works fine, we can read the href:
    <A href="site.aspx">A Staffing Request Form</A>

    But this does not, the editor inserts some nested formatting tags and we can cannot get the parent tag href any longer:
    <A href="site.aspx"><FONT color=#0000ff><STRONG>A Staffing Request Form</STRONG></FONT></A>

    We cannot ask our users to change the HTML, please advise on how to read the href here and change it, based on the sample we have downloaded (or something we have missed).

    Thank you.
  2. Ianko
    Ianko avatar
    1507 posts

    Posted 02 Sep 2013 Link to this post

    Hello Peter,

    The encountered issue is happening because with the current custom implementation of this link manager the selected element is considered as an Anchor HTML element, however in the problematic scenario it is a strong HTML element, which does not have a href attribute.

    Currently I could suggest you two possible solutions:

    • If the nested elements are build from custom logic in your project then you could consider using the additional tags outside the Anchor element, so that it does not have any child elements.
      <FONT color=#0000ff><STRONG><A href="site.aspx">A Staffing Request Form</A></STRONG></FONT>
    • Other possibility is to implement further the logic of the custom link manager and more specifically to check if the received element is an Anchor and if it is not, to get its parent element. The following code sample will get you started with this approach:
      var elem = editor.getSelectedElement();
      while(elem && elem.tagName != "A")
          elem = elem.parentElement;
    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.
  3. DevCraft R3 2016 release webinar banner
  4. Peter Bulloch
    Peter Bulloch avatar
    13 posts
    Member since:
    Mar 2010

    Posted 02 Sep 2013 Link to this post

    Thank you
Back to Top