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

RadDock Custom Attributes Undefined in FireFox

2 Answers 67 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Sa_MMM
Top achievements
Rank 1
Sa_MMM asked on 08 Dec 2010, 01:32 PM
I have a simple program where I assign attributes to a raddock in Page_Load and then pull these attributes using Javascript when the dock is moved (dock.get_element().MyAttribute).  In IE, this works great, but in FireFox and Safari the "get_element().MyAttribute" always returns "undefined".  I'm assuming it is simple syntax, but need some guidance.

ASPX:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  
<%@ 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">
  
  
  
<script type="text/javascript">
    var zones;
    function OnClientInitialize(dock, args) {
        zones = Telerik.Web.UI.RadDockZonesGlobalArray;
    }
    function OnDockChangedPosition(dock, args) {
        var zone;
        zone = dock.get_dockZone();
        var sDockJustMoved;
        sDockJustMoved = "";
        sDockJustMoved = dock.get_element().TestDock + "~" + zone.get_element().TestZone;
        alert(sDockJustMoved);
    }
</script>
  
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
    <div>
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
            <telerik:RadDockZone ID="RadDockZone1" runat="server" Height="300px" Width="300px">
                <telerik:RadDock ID="RadDock1" runat="server" Width="300px" OnClientDockPositionChanged="OnDockChangedPosition">
                </telerik:RadDock>
            </telerik:RadDockZone>
            <telerik:RadDockZone ID="RadDockZone2" runat="server" Height="300px" Width="300px">
            </telerik:RadDockZone>
        </telerik:RadDockLayout>
    </div>
    </form>
</body>
</html>

CODE:
Partial Class _Default
    Inherits System.Web.UI.Page
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RadDock1.Attributes.Add("TestDock", "Dock Attribute")
        RadDockZone1.Attributes.Add("TestZone", "Zone1 Attribute")
        RadDockZone2.Attributes.Add("TestZone", "Zone2 Attribute")
    End Sub
End Class


VS 2008, Telerik 2010.2.713.35

2 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 08 Dec 2010, 02:17 PM
Hello,

I believe this is browser related behavior, that's why I would recommend using the element.getAttribute(AttrName) method to get the value of the attribute assigned from the server. Basically, your JavaScript function should look like the following:

<script type="text/javascript">
    var zones;
    function OnClientInitialize(dock, args) {
        zones = Telerik.Web.UI.RadDockZonesGlobalArray;
    }
    function OnDockChangedPosition(dock, args) {
        var zone;
        zone = dock.get_dockZone();
        var sDockJustMoved;
        sDockJustMoved = "";
        sDockJustMoved = dock.get_element().TestDock + "~" + zone.get_element().getAttribute("TestZone");
        alert(sDockJustMoved);
    }
</script>


Greetings,
Pero
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sa_MMM
Top achievements
Rank 1
answered on 08 Dec 2010, 02:33 PM
Pero,

You are absolutely right!  That fixed it!  Thank you!
Tags
Dock
Asked by
Sa_MMM
Top achievements
Rank 1
Answers by
Pero
Telerik team
Sa_MMM
Top achievements
Rank 1
Share this question
or