RadDock Custom Attributes Undefined in FireFox

3 posts, 1 answers
  1. Sa_MMM
    Sa_MMM avatar
    4 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2010 Link to this post

    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. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 08 Dec 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sa_MMM
    Sa_MMM avatar
    4 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2010 Link to this post

    Pero,

    You are absolutely right!  That fixed it!  Thank you!
Back to Top