Customise InsertHyperlinkDialog

2 posts, 1 answers
  1. Simon
    Simon avatar
    32 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2017 Link to this post


    I'd like to customise the InsertHyperlinkDialog so that it only accepts links that start with http. Is there any way to do this?

  2. Answer
    Dimitar avatar
    2960 posts

    Posted 08 Sep 2017 Link to this post

    Hello Simon,

    By default when the user presses the OK button the "http://" is inserted at the beginning of the link. However, you can insert it when the user starts typing in the text box. The following example shows how you can create custom dialog access the text box and change the text:
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
        public RadForm1()
            radRichTextEditor1.RichTextBoxElement.InsertHyperlinkDialog = new MyInsertHyperlinkDialog();
    class MyInsertHyperlinkDialog : InsertHyperlinkDialog
        public MyInsertHyperlinkDialog()
            var textbox = this.Controls[7] as RadTextBox;
            textbox.TextBoxElement.TextBoxItem.TextChanged += Textbox_TextChanged;
        private void Textbox_TextChanged(object sender, EventArgs e)
            var textbox = sender as RadTextBoxItem;
            if (!textbox.Text.Contains("http://"))
                textbox.Text = "http://" + textbox.Text;
                textbox.SelectionStart = textbox.Text.Length;

    I hope this will be useful. Let me know if you have additional questions.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top