Preview Event For Editor

4 posts, 2 answers
  1. Testing
    Testing avatar
    31 posts
    Member since:
    Nov 2013

    Posted 05 Feb 2014 Link to this post

    Hi,
    How to handle preview event of editor,
    In that event I want to perform replace some text coming from db.

    thank you
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    5512 posts

    Posted 05 Feb 2014 Link to this post

    Hello,

    You can use the OnClientModeChange event to know when the user goes into preview mode: http://www.telerik.com/help/aspnet-ajax/editor-onclientmodechange2.html.


    Regards,
    Marin Bratanov
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. Testing
    Testing avatar
    31 posts
    Member since:
    Nov 2013

    Posted 05 Feb 2014 Link to this post

    Hello,
    It working perfectly, in that event I call server side button click event after executing server side the state of preview option is not maintain .. it again goes to design mode.
    How can I maintain preview state after executing server side event?
  4. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Feb 2014 in reply to Testing Link to this post

    Hi,

    Please try the following code snippet to achieve your scenario.

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        //your code
        string script = "function f(){ChangeMode(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
    }

    JavaScript:
    <script type="text/javascript">
        function ChangeMode() {
            var editor = $find("<%=RadEditor1.ClientID %>");
            editor.set_mode(4);
        }
    </script>

    Hope this will helps you.
    Thanks,
    Shinu.
Back to Top