Thread: Get Page Width

    #1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Apr 2006
    Posts
    118
    Rep Power
    9

    Get Page Width


    I have a page that I need to get the page width when it loads. I know how to do this in javascript but the problem is that the .net controls get loaded before the javascript get fired so if I get the value using javascript and pass that to a hidden feild it does no good, because the control that I need to calculate has alread fired. What I need is a way to get the page width in the code behind on the Page_Load
  2. #2
  3. No Profile Picture
    Contributing User
    ASP Adventurer (500 - 999 posts)

    Join Date
    Sep 2005
    Posts
    744
    Rep Power
    55
    Just resize the control dynamically with the javascript.

    Let the control render however it does first, then execute the javascript when the page loads to resize it.

    Its not a good idea to let javascript render size for you, though.
    I take donations in increments of $100.
  4. #3
  5. Slaprentice of Wolves
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2007
    Location
    Mossville, IL
    Posts
    1,469
    Rep Power
    539
    Originally Posted by seran128
    I have a page that I need to get the page width when it loads. I know how to do this in javascript but the problem is that the .net controls get loaded before the javascript get fired so if I get the value using javascript and pass that to a hidden feild it does no good, because the control that I need to calculate has alread fired. What I need is a way to get the page width in the code behind on the Page_Load
    I'm fairly sure this is not possible since all the work in the code behind has completed before the page is sent to the client. Since all the work is done on the server side, I don't see how it would know the current width.
    Wolffy
    ------------------------
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. Not FDIC insured

Similar Threads

  1. Send values from one page form to another
    By antonyx in forum ASP Development
    Replies: 1
    Last Post: June 21st, 2006, 05:15 AM
  2. Auto submit another asp page from aspx page
    By cgmenon in forum ASP Development
    Replies: 7
    Last Post: May 2nd, 2006, 04:51 AM
  3. Problem with creating a review before submitting page
    By wacara in forum ASP Development
    Replies: 3
    Last Post: May 1st, 2006, 06:40 AM
  4. display records using page size and sql
    By aditya1_in in forum Code Bank
    Replies: 0
    Last Post: March 28th, 2005, 11:45 AM
  5. Login & Password HELP!!!!!!!!
    By Daz in forum ASP Development
    Replies: 1
    Last Post: May 23rd, 2004, 01:11 PM

IMN logo majestic logo threadwatch logo seochat tools logo