Raddock height at client side

4 posts, 1 answers
  1. Ram
    Ram avatar
    97 posts
    Member since:
    Jun 2011

    Posted 25 Jan 2012 Link to this post

    Hi all,
    How to determine the RadDock height at codebehind and also clientside.
    I am not setting RAdDock height explicitly,and I'm creating docks dynamicaly from code behind.
    Depending on the controls in RadDock and the content in the Controls its height varies.
    Even Edit of RadDock changes the height of RAdDock.
    So can anyone help me in accessing the height everytime i make changes at runtime .(Both codebehind and Clientside)
    pls help me asap.its very imp
    Note:I'm using dock and old raddockableobject
    Thank you.

  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 27 Jan 2012 Link to this post

    Hello Ram,

    When managing the RadDock control on the sever-side you can use its property Height to reference the current height or to specify a new one.

    On the client-side you can use the methods of  get_height and set_height of the RadDock's client object in order to access the height value and to change it. This help article contains more information on utilizing the Client API of the dock control.

    Greetings,
    Slav
    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. Ram
    Ram avatar
    97 posts
    Member since:
    Jun 2011

    Posted 28 Jan 2012 Link to this post

    Hello Slav,
    Thanks for reply.
    But I mentioned in my post that I was not setting the height for the dock at serverside since I was loding the usercontrols which contains radgrid.
    Dock will automaically resize to the user control height.
    So when I try to get the dock height at client side its giving null.
    I used getheight also but its giving object.

    I'm trying to get the height of dock as follows

    function resizeFrame() {
                   var dockZone1 = $find("<%=RadDockZone1.ClientID %>");
                   var dockZone2 = $find("<%=RadDockZone2.ClientID %>");
                   var docks1 = dockZone1.get_docks();
                   var docks2 = dockZone2.get_docks();
                   var frame = window.frameElement;
                   var i;
                   var leftZoneDocksHeight = 0;
                   var rightZoneDocksHeight = 0;
                   var currentheight = 0;
                   if (docks1.length >0 || docks2.length > 0) {                    
                           for (i = 0; i < docks1.length; i++) {
                               leftZoneDocksHeight += parseInt(docks1[i]._height);                            
                           }
                           for (i = 0; i < docks2.length; i++) {
                               rightZoneDocksHeight += parseInt(docks2[i]._height);
                           }

    frame.style.height = leftZoneDocksHeight > rightZoneDocksHeight ? leftZoneDocksHeight + 88 +

     

    "px" : rightZoneDocksHeight + 88+ "px";

     


    }
    pls help me in this regard asap.
  5. Answer
    Slav
    Admin
    Slav avatar
    1355 posts

    Posted 01 Feb 2012 Link to this post

    Hi Ram,

    First of all, I would recommend using the get_height client-side method, when getting the value of a RadDock Height property. In your case this method will return null because you haven't set the Height property of the RadDock controls on your page. In order to get the current height of the dock control, you can use the getBounds method of Telerik static client library by passing as a parameter the DOM element of a particular RadDock. Below you can check a code sample that shows how this approach can be applied to your method:
    if (docks1.length > 0 || docks2.length > 0) {
        for (i = 0; i < docks1.length; i++) {
            leftZoneDocksHeight += parseInt($telerik.getBounds(docks1[i].get_element()).height);
        }
        for (i = 0; i < docks2.length; i++) {
            rightZoneDocksHeight += parseInt($telerik.getBounds(docks2[i].get_element()).height);
        }
     
        var result = leftZoneDocksHeight > rightZoneDocksHeight ? leftZoneDocksHeight + 88 + "px" : rightZoneDocksHeight + 88 + "px";
    }

    All the best,
    Slav
    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
Back to Top