Update LinkText

2 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    20 posts
    Member since:
    Apr 2011

    Posted 28 Jun 2014 Link to this post


    I am using RadRichTextBox, and in my scenario user can add hyperlinks to RichText to some application entities. Those entities can change their names outside of the richtextbox, so I need to update hyperlink text with corresponding data. But documentation about HyperlinkRangeStart does not give any clues how to update hyperlink text.

    Can someone please tell me how can I accomplish my task?

  2. Petya
    Petya avatar
    973 posts

    Posted 01 Jul 2014 Link to this post

    Hello Dmitry,

    There is no API which allows to directly edit a hyperlink. I'd suggest you select the hyperlink and replace it instead. The below snippet shows how this can be achieved using the HyperlinkRangeStart of the first link in a document.
    string newText = "NEW TEXT";
    HyperlinkRangeStart start = this.radRichTextBox.Document.EnumerateChildrenOfType<HyperlinkRangeStart>().FirstOrDefault();
    if (start != null)
        var info = start.HyperlinkInfo;
        this.radRichTextBox.InsertHyperlink(info, newText);

    I hope this helps.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft banner
Back to Top