开发者

Need to read gridview height after databind

开发者 https://www.devze.com 2022-12-31 01:57 出处:网络
I have two panels on the same page, side by side. On contains a gridview. I want to determine the height of the gridview after databinding and set the height of the other panel correspondingly, but wh

I have two panels on the same page, side by side. On contains a gridview. I want to determine the height of the gridview after databinding and set the height of the other panel correspondingly, but when I try to read the height of开发者_高级运维 the gridview it comes back as 0. How do I get it's height, preferably in PX?


You can better do it in javascript. Get the offsetHeight of datagrid in javascript and set the height of other panel as below.

var height = document.getElementById("<%=GRIDID_CONTROL.ClientID%>").offSetHeight;
document.getElementById("<%=PANEL_CONTROL.ClientID%>").style.height = height;

Write this script at the end of page, so that you have markup rendered for the controls.

0

精彩评论

暂无评论...
验证码 换一张
取 消