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

Dock Layout in Table Row display:none cause Javascript Error

3 Answers 59 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Sean Sparkman
Top achievements
Rank 2
Sean Sparkman asked on 21 Apr 2010, 09:18 PM
Telerik Version:  2010.1.309.35
Browser:  Firefox, Chrome
When setting the style of a table row to display none on the server side, the javascript client side throws an error.

this._middleRightBar is undefined
ScriptResource.axd?d=WMQz7XgxBIdcpwwythMfyxAMDy1VyYjq5NEdNFqBICqtGSNJXx-Yax1OJRMKYw6z0&t=5ffe9675
Line: 
this._middleRightBar.setAttribute("unselectable","on");

<tr id="OptionsRow" runat="server"
        <td style="vertical-align: text-top;" colspan="2"
            <telerik:RadDockLayout ID="OptionsLayout" runat="server" EnableEmbeddedSkins="false"
                <telerik:RadDockZone runat="server" 
                                     ID="OptionsZone" 
                                     BorderWidth="0px" 
                                     BorderStyle="None"
                    <telerik:RadDock runat="server" 
                                     ID="RadDockPriority" 
                                     EnableDrag="False" 
                                     Visible="true" 
                                     Collapsed="true" 
                                     BackColor="#000099" 
                                     Skin="Office2007" 
                                     DefaultCommands="None"

    Public Sub HideRow(ByRef row As HtmlTableRow) 
        If Not Account.IsDeveloper OrElse True Then 
            row.Attributes.Add("style""display: none;"
        Else 
            row.Attributes.Add("style""background-color: #c0c0c0;"
        End If 
    End Sub 

Work Around:
Set the RadDockLayout.Visible = False

3 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 26 Apr 2010, 04:24 PM
Hi Sean,

The dock renders a <table/> on the client, and if some of its rows are missing (not rendered) then a JavaScript error, similar as the one you got, will be thrown. That's why, the users should be extremely helpful to not alter or modify the standard HTML rendered by the RadDock control.

All the best,
Pero
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sean Sparkman
Top achievements
Rank 2
answered on 26 Apr 2010, 10:19 PM
The html that is edited is wrapped around the RadDockLayout.  It is not the html generated by RadControl.
0
Pero
Telerik team
answered on 29 Apr 2010, 01:12 PM
Hi Sean,

I couldn't reproduce the exact issue locally, but as I said this JS error is usually thrown when some of the <tr/>s are missing. Test the following code and you will notice that a similar error will be thrown:

.aspx
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        </Scripts>
    </asp:ScriptManager>
    <div>
        <table id="table1" runat="server">
            <tr id="OptionsRow" runat="server">
                <td style="vertical-align: text-top;" colspan="2">
                    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                        <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                            <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px">
                                <ContentTemplate>
                                    <br />
                                    <br />
                                    <br />
                                    <br />
                                    <br />
                                    CONTENT
                                    <br />
                                    <br />
                                    <br />
                                    <br />
                                    <br />
                                </ContentTemplate>
                            </telerik:RadDock>
                        </telerik:RadDockZone>
                    </telerik:RadDockLayout>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.UI.HtmlControls;
 
public partial class Default_Dock : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        var htmlTable = new HtmlTable();
        htmlTable.Rows.Add(new HtmlTableRow());
        htmlTable.Rows.Add(new HtmlTableRow());
        RadDock1.Controls.AddAt(0, htmlTable);
        base.OnInit(e);
    }
}

If the current fix works for you (i.e. setting Visible="false" to the layout), then you shouldn't change it, but it would help us a lot in tracking the source of the problem, if you could provide a sample project that recreates the issue.

Regards,
Pero
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Dock
Asked by
Sean Sparkman
Top achievements
Rank 2
Answers by
Pero
Telerik team
Sean Sparkman
Top achievements
Rank 2
Share this question
or