开发者

Determine the height of a GridView during data binding

I need to manually page a G开发者_C百科ridView based report, i.e. add a second page and GridView, when the height of my first GridView exceeds a limit. Is there a way I can determine the height of the GridView while data binding?


Based on height, I am not sure if this possible during binding.

Instead I will do by counting number of rows.


You can use Javascript to get the value of Height being rendered in the Page like

<script language="javascript" type="text/javascript">

function getValue()
{

    var _gridheight= document.getElementById("GridView1").clientHeight;
    alert(_gridheight);

}

</script>


By default, the GridView will render as high as it needs to be. Is your problem with a surrounding container?


Eventually, the height will be determined by the browser, so there is no way you can predict it on the server side (during data-binding). The only accurate way to measure it will be on the client side, using HotTester's solution.

The best you can do on the server side is an educated guess.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜