RadEditors in Tabstrip Multipage bug

4 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 16 Dec 2011 Link to this post

    Already a long time we have the following setup

    RadTabstrip with multipage and RadEditors in several tabs.

    With this function we set the class of contentArea for each editor
    function OnClientLoad(editor, args)
    {
    editor.get_contentArea().className = "Inhoud";
    }

    This class was always persisted when switching back and forth over the tabstrip.

    Now in Q3-2011 the class on the contentArea is lost when I navigate back to a tab which was already opened before.

    Please assist.

    Marc
  2. Rumen
    Admin
    Rumen avatar
    12850 posts

    Posted 16 Dec 2011 Link to this post

    Hello Fit2page,

    You can fix the problem using the following code:
    <head runat="server">
        <title></title>
        <style type="text/css">
        .Inhoud { background-color: Red; }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="Scriptmanager1" runat="server" />
        <telerik:RadTabStrip ID="RadTabStrip1" OnClientTabSelected="OnClientTabSelected" 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:RadEditor ID="RadEditor1" runat="server"></telerik:RadEditor>
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageView2" runat="server">
                    <telerik:RadEditor ID="RadEditor2" runat="server"></telerik:RadEditor>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
     
         <script type="text/javascript">
             function pageLoad() {
                 ChangeEditorInTabStrip($find("<%= RadTabStrip1.ClientID %>"));
             }
             function OnClientTabSelected(tabStrip, args) {
                 ChangeEditorInTabStrip(tabStrip);
             }
     
             function ChangeEditorInTabStrip(tabStrip) {
                 var tabContent = tabStrip.get_multiPage().get_selectedPageView().get_element();
                 var editors = get_allRadEditors(tabContent);
                 for (i = 0; i <= editors.length; i++) {
                     var editor = editors[i];
                     editor.get_contentArea().className = "Inhoud";
                 }
             }
     
             function get_allRadEditors(parent) {
                 var allRadEditors = $telerik.$.grep($telerik.radControls, function (control) {
                     return Telerik.Web.UI.RadEditor && control instanceof Telerik.Web.UI.RadEditor && $telerik.$.contains(parent, control.get_element());
                 });
     
                 return allRadEditors;
             }
        </script>
     
        </form>
    </body>
    </html>


    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 19 Dec 2011 Link to this post

    Thanks Rumen, but I am getting "editor is undefined" in FF?
  5. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 19 Dec 2011 Link to this post

    Rumen,

    In yr script it should say:

    for (i = 0; i < editors.length; i++) {

    Instead of

    for (i = 0; i <= editors.length; i++) {

    Thanks anyway, it works now... :-)
     Marc
Back to Top