Change links in htm with Radeditor in c#

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    7 posts
    Member since:
    Jul 2012

    Posted 13 Jul 2012 Link to this post

    Hi, I want to change htm's name and his links too, for this i'm trying to use radeditor, my question is, it's posible to modify links in htm with radeditor in c#?, i'm trying with this code:
     RadEditor1.Content = ReadFile(Server.MapPath("~/"+Root()+"/example.htm");
                        string mod = Root().Replace(" ", "%20");
                         using (StreamWriter externalFile = new StreamWriter(Path.Combine(Server.MapPath("~/"+NewRoot), "Newexample.htm"), false, Encoding.UTF8))//Open file for writing and write content
     protected string ReadFile(string path)
            if (!System.IO.File.Exists(path))
            { return string.Empty; }//fin if file exists
            using (System.IO.StreamReader sr = new System.IO.StreamReader(path, Encoding.GetEncoding("macintosh")))
            { return sr.ReadToEnd(); }
    but I think that Replace() no work with html, please help me
  2. Rumen
    Rumen avatar
    14421 posts

    Posted 17 Jul 2012 Link to this post


    If you want to update the links in RadEditor, you should do that on the client by implementing a custom content filter. If you want to do that on the server, you can do that after you obtain the RadEditor's content via the Content property. The Content property returns a standard string which you can modify using the String.Replace method and if needed regular expressions.

    All the best,
    the Telerik team
    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 their blog feed now.
Back to Top