Hi Terisa, you can use a HTML table with the Width property set to 100%. This way you can fix the table to the screen automatically.
Another way its obtain the width and height of the client browser and set in the onload event.
Regards
Christian Manuel Amado Silva
[MCITP] Windows Vista Consumer Support Technician
[MCTS] Windows Vista, Configuration
[MCTS] .NET Framework 2.0: Web Applications
[MCTS] Microsoft Windows Mobile 5.0 Application Development
[MCTS] Microsoft SQL Server 2005
[MOS] Microsoft Office Master Specialist
function TableHeight() {
if( typeof( window.innerWidth ) == 'number' ) {number means value for width in pixels????? can i put this javascript in master page??
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
Input is highly appreciated!!
Please click 'Mark as Answer' if my reply helps you. Thanks and Good Luck!!
Putting everything into <table width="100%"></table> is your solution unless you have special needs. which make it impossible to use this solution. therefore either identify these needs and explain in details why you can' t use HTML table, or mark peoples'
answers and let it go.
Alexei Fimine
_____________
"And though I have the gift of prophecy, and understand all mysteries, and all knowledge; and though I have all faith, so that I could remove mountains, and have not charity, I am nothing"
Yes, I did put the table width to 100%, but when i checked in different resolutions till width is perfect for any resolution but prob is with height, for ex., 800 X 600 when i tested wisth is perfect for height it had vertical scroll bar, same with other
resolutions its not fixed..thats the problem..
Please click 'Mark as Answer' if my reply helps you. Thanks and Good Luck!!
proguser7
Member
38 Points
79 Posts
How to resize the web page automatically based on user's web browser screen resolution?
Sep 14, 2009 07:09 PM|LINK
Hi All,
I have created a web page, different users have different screen resolution like 800 X 600, 1280 X 1024 etc.,
Is there any way where it detects automatically and fits the contents according to respective screen resolution?
VS 2005, .Net 2.0 and c#
ANy inputs is highly appreciated.
Thanks,
Terisa
NecroxPy
Participant
1370 Points
251 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 14, 2009 08:09 PM|LINK
Hi Terisa, you can use a HTML table with the Width property set to 100%. This way you can fix the table to the screen automatically.
Another way its obtain the width and height of the client browser and set in the onload event.
Regards
[MCITP] Windows Vista Consumer Support Technician
[MCTS] Windows Vista, Configuration
[MCTS] .NET Framework 2.0: Web Applications
[MCTS] Microsoft Windows Mobile 5.0 Application Development
[MCTS] Microsoft SQL Server 2005
[MOS] Microsoft Office Master Specialist
Mark a post as an answer when it is
aderegil
Contributor
3318 Points
593 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 14, 2009 08:09 PM|LINK
Hello!
You need to define a dynamic layout. It is purely defined with your HTML/CSS code, it can be done in either platform (like .net 2.0).
Take a loot at the following resource: http://www.dynamicdrive.com/style/layouts/
And here's another one: layouts.ironmyers.com
Good luck.
proguser7
Member
38 Points
79 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 16, 2009 04:43 PM|LINK
wat should be the standard width and hight for the website for any screen resolution? width = 100% , height?
nikhiljon
Member
108 Points
89 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 16, 2009 05:27 PM|LINK
Hi buddy,
Try this javascript to set height based on resolution.
function TableHeight() {
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
document.getElementById('ctl00_divContent').style.height= (myHeight-170)+'px';
}
proguser7
Member
38 Points
79 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 16, 2009 05:38 PM|LINK
Hi Buddy,
Thanks for ur reply.
I have one doubt.
function TableHeight() {
if( typeof( window.innerWidth ) == 'number' ) {number means value for width in pixels????? can i put this javascript in master page??
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
Input is highly appreciated!!
proguser7
Member
38 Points
79 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 17, 2009 02:06 PM|LINK
Hi All,
Any ideas ??
fimine
Contributor
3008 Points
549 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 17, 2009 02:17 PM|LINK
What other ideas are you looking for?
Putting everything into <table width="100%"></table> is your solution unless you have special needs. which make it impossible to use this solution. therefore either identify these needs and explain in details why you can' t use HTML table, or mark peoples' answers and let it go.
_____________
"And though I have the gift of prophecy, and understand all mysteries, and all knowledge; and though I have all faith, so that I could remove mountains, and have not charity, I am nothing"
proguser7
Member
38 Points
79 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 17, 2009 02:24 PM|LINK
Yes, I did put the table width to 100%, but when i checked in different resolutions till width is perfect for any resolution but prob is with height, for ex., 800 X 600 when i tested wisth is perfect for height it had vertical scroll bar, same with other resolutions its not fixed..thats the problem..
nikhiljon
Member
108 Points
89 Posts
Re: How to resize the web page automatically based on user's web browser screen resolution?
Sep 17, 2009 04:24 PM|LINK
if( typeof( window.innerWidth ) == 'number' )
it is only checking width is in number format
just replace ur centerbody div with ur masterpage id should be look like this......
document.getElementById('ctl00_centerbody').style.height= (myHeight-170)+'px';