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

Raddock height at client side

3 Answers 81 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 25 Jan 2012, 10:57 AM
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.

3 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 27 Jan 2012, 12:15 PM
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
0
Ram
Top achievements
Rank 1
answered on 28 Jan 2012, 09:37 AM
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.
0
Accepted
Slav
Telerik team
answered on 01 Feb 2012, 04:28 PM
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
Tags
Dock
Asked by
Ram
Top achievements
Rank 1
Answers by
Slav
Telerik team
Ram
Top achievements
Rank 1
Share this question
or