Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9037659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:17:50+00:00 2026-06-16T09:17:50+00:00

I am using ASP.NET and C#.I can able to get the document height using

  • 0

I am using ASP.NET and C#.I can able to get the document height using javascript with this.

var h = document.documentElement.offsetHeight;

Now i need this value during pageload. But the javascript will be start exicuting after pageload. So now i need to get it using server side code(C#).

Is it possible?

EDIT:

In pageload i am planning to set the height for all the tags based on the document height.
So that the page will fit for all resolution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:17:52+00:00Added an answer on June 16, 2026 at 9:17 am

    You can’t get this value using server-side code, as it is, by definition, server-side.

    You could however use JavaScript to pass the value back to an ASP.NET script via AJAX, and take whatever action you need to take at this point. Of course this means that you wouldn’t be able to, for example, provide different content onload for different screen sizes, but it all depends on your intentions.

    Since you need it on pageload, one very very hacky way to do this would be to detect the browser height and then redirect, for example pass it as a querystring value that you can use directly within PageLoad. What I mean specifically is, use JavaScript to detect this QS value (for example ?ph=768), and if it’s not there, redirect the page to itself, appending on ?ph=768. That way you can use it to get the page height on document load.

    As mentioned by @J.Steen in comments, though, it’s probably better to define your intentions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC I am able to replace the FilterProvider as so var oldProvider
I am building a web site in C# using asp.NET MVC How can I
Using ASP.net, what methods can I use to do the following: Open up a
I'm using ASP.NET Web Pages to create a form in which I can select
I am using asp.net forms authentication, membership provider and role provider. You can refer
I'm creating REST service using ASP.NET Web API. How can I return 401 status
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
Using VS2008 and ASP.NET 3.5 (or VS 2010 / .NET 4.0?), how can I
When sending email using the SMTPClient class in ASP.NET C#, how can I add
plz guide me how I can enable or disable asp.net validation controls using jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.