Vaccano
Vaccano

Reputation: 82369

How to find the Vertical size of a window displaying a web page

I have an ASP.NET Site that has a single Master Page. On one of my pages in this site I display a PDF file as the content of the page.

I need a way to know the size that I can make the PDF control so that I do not create a scroll bar for the webpage (the PDF control has it's own scroll bar).

I was able to solve this horizontally by setting the width of the control to 100%. Sadly this does not work for the Vertical size.

Any help is appreciated.

Vaccano

Upvotes: 1

Views: 286

Answers (2)

tsilb
tsilb

Reputation: 8037

If you do use JavaScript, however, there is a workaround where you can put that value into a HiddenField (Which of course JavaScript would see as an Input), and click a Submit button, all behind the scenes. If you use an UpdatePanel, you may be able to get away with a partial postback without user intervention.

For the button clickery, look into Document.Forms[0].btnMyButton.Click();.

Upvotes: 0

John Sheehan
John Sheehan

Reputation: 78132

There's no way to determine this server-side, so you'll need to use JavaScript. I'd recommend the jQuery Dimensions plug in.

Upvotes: 2

Related Questions