Editor in TabStrip/PageView OnClientLoad Issue

7 posts, 1 answers
  1. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 21 Mar 2012 Link to this post

    I have a page with several RadEditors and also RadTabStrip with RadPageViews.

    I want paste plain text to be the default for all editors so I have added the following JavaScript to all RadEditor OnClientLoad events.
    function OnClientLoad(editor, args) {
    var element = document.all ? editor.get_document().body : editor.get_document();
    $telerik.addExternalHandler(element, "paste", function (e) {
    editor.fire("PastePlainText");
    if (e.preventDefault) e.preventDefault();
    if (e.stopPropagation) e.stopPropagation();
    return false;
    });
    }

    Problem is that this only works if the RadEditor is outside the TabString/PageView or in the first tab -- if it's in another tab the code doesn't work.

    Is there a solution to this problem?
  2. Rumen
    Admin
    Rumen avatar
    13884 posts

    Posted 23 Mar 2012 Link to this post

    Hello,

    The following code works fine on my side:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="MultiPage1">
        <Tabs>
            <telerik:RadTab Text="Tab1" PageViewID="PageView1">
            </telerik:RadTab>
            <telerik:RadTab Text="Tab2" PageViewID="PageView2">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="MultiPage1" runat="server">
        <telerik:RadPageView ID="PageView1" runat="server" Selected="true">
                 
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView2" runat="server">
              <telerik:RadEditor ID="RadEditor1" OnClientLoad="OnClientLoad" runat="server"></telerik:RadEditor>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
    <script type="text/javascript">
        function OnClientLoad(editor, args) {
            var element = document.all ? editor.get_document().body : editor.get_document();
            $telerik.addExternalHandler(element, "paste", function (e) {
                alert(1);
                editor.fire("PastePlainText");
                if (e.preventDefault) e.preventDefault();
                if (e.stopPropagation) e.stopPropagation();
                return false;
            });
        }
     
    </script>

    as you can see in the following video: http://screencast.com/t/4pl1AfCkXip.

    Please, isolate the problem in a sample working project and send it for examination via  a new support ticket. I will research it and try to provide a solution after that.

    Kind regards,
    Rumen
    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.
  3. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 25 Mar 2012 Link to this post

    Here is my code. If I press CTRL+V to paste some rich text inside the RadEditor in tab 1 it pastes plain text. If I do the same in the RadEditor in the second tab it doesn't paste plain text.
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test2.aspx.cs" Inherits="Admin.Test2" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
     
        <script type="text/javascript">
        function OnClientLoad(editor, args) {
            var element = document.all ? editor.get_document().body : editor.get_document();
            $telerik.addExternalHandler(element, "paste", function (e) {
                editor.fire("PastePlainText");
                if (e.preventDefault) e.preventDefault();
                if (e.stopPropagation) e.stopPropagation();
                return false;
            });
            editor.get_dialogOpener()._dialogUrlLengthLimit = 500;
        }
        </script>
        <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
     
        <telerik:RadTabStrip ID="TabStrip" runat="server" CausesValidation="false" MultiPageID="MultiPage" SelectedIndex="0">
            <Tabs>
                <telerik:RadTab Text="AAAAAA"></telerik:RadTab>
                <telerik:RadTab Text="BBBBBB"></telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
     
        <telerik:RadMultiPage ID="MultiPage" runat="server" CssClass="tabpage" SelectedIndex="0">
            <telerik:RadPageView ID="a" runat="server">
                <telerik:RadEditor ID="ShortContent" runat="server" BorderStyle="None" EnableResize="false" Height="200px" MaxTextLength="1000"
                    NewLineBr="false"
                    ContentFilters="FixUlBoldItalic,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent"
                    ToolbarMode="Default" ToolsFile="~/FullContent.xml" Width="608px" OnClientLoad="OnClientLoad"
                    SpellCheckSettings-AllowAddCustom="false" StripFormattingOptions="NoneSupressCleanMessage"></telerik:RadEditor>
            </telerik:RadPageView>
            <telerik:RadPageView ID="b" runat="server">
                <telerik:RadEditor ID="FullContent" runat="server" BorderWidth="0" EnableResize="false" NewLineBr="false" ToolbarMode="Default"
                    ContentFilters="FixUlBoldItalic,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent"
                    ToolsFile="~/FullContent.xml" Width="608px" OnClientLoad="OnClientLoad" SpellCheckSettings-AllowAddCustom="false"
                    StripFormattingOptions="NoneSupressCleanMessage"></telerik:RadEditor>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
     
     
        </form>
    </body>
    </html>

    I am using version 2011.3.1115.40.
  4. Answer
    Rumen
    Admin
    Rumen avatar
    13884 posts

    Posted 28 Mar 2012 Link to this post

    Hello,

    Please, update the Telerik.Web.UI.dll under your project to version 2012.1.215. I tested the provided markup and I was unable to reproduce the issue neither in in IE, Firefox, nor in Chrome as shown in the following video: http://screencast.com/t/8SMzk1MXzW.

    All the best,
    Rumen
    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.
  5. John
    John avatar
    31 posts
    Member since:
    May 2011

    Posted 28 Mar 2012 Link to this post

    The upgrade to the latest version solved the problem, there must be a problem with the Q3 2011 release.

    Thank you.
  6. Kamlesh
    Kamlesh avatar
    1 posts
    Member since:
    Jan 2013

    Posted 21 Jun 2013 Link to this post

    Hi,

    I Have One RadTabStrip and In that Two RadTab and One RadMultiPageView In that two RadPageView
    Each RadPageView have One RadEditor

    My Problem is :- when I select Second RadPageView Directly through Server Side Code Then my Second RadPageView's RadEditor Not Working I try With upgrade Version of Telerik.Web.UI but its not working....
  7. Vessy
    Admin
    Vessy avatar
    1976 posts

    Posted 25 Jun 2013 Link to this post

    Hello Kamlesh,

    I am not quite sure whether I understand the exact scenario correctly. Could you elaborate more on what exactly do you mean with "my Second RadPageView's RadEditor Not Working"? Does the control is shown, but not functioning correctly or the whole MultiPage is not refreshed, showing the Editor from the first tab?

    For your convenience I am attaching my test page - are you able to reproduce the same issue with it? Can you modify it up to a point where the problem occurs and send it back so we could investigate it further?

    Thank you in advance for your cooperation.

    Regards,
    Veselina Raykova
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top