This is a migrated thread and some comments may be shown as answers.

RadEditors in Tabstrip Multipage bug

3 Answers 66 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 16 Dec 2011, 01:23 PM
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

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Dec 2011, 04:54 PM
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
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Dec 2011, 09:16 AM
Thanks Rumen, but I am getting "editor is undefined" in FF?
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Dec 2011, 02:41 PM
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
Tags
Editor
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Rumen
Telerik team
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or