473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Resizing Frame

Hi All,
I would like to ask how can one resize a frame in a website w/o
postback?
My scenario is the following
I have a left frame, a top frame, and a "contents" frame.
I placed an imagebutton in the top frame that once clicked, it will
fire
a javascript code the will resize the left frame (collapse), then if
clicked again,
it will "expand" or restore the left frame's size back to its
original size.

My problem is that whenever you click the image button in the top
frame to
resize the left frame, the top frame posts back.

Is there anyway for the top frame not to postback?

Thanks,
Henry

Javascript
================================================== =========
function jsfToggleNavFrame()
{
var frame = window.parent.document.getElementById("fstMainLayo ut");
var navFrameCol = frame.cols.substr(0, frame.cols.indexOf(','));
alert (navFrameCol);
if (navFrameCol != 216)
{
frame.cols="216,*";
}
else
{
frame.cols="*,100%";
}
}
Code Behind
================================================== =========

protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetTyp e(),
"jsfUtility", "<script type='text/javascript' language='javascript'
src='./Script_Data/jsfUtility.js'></script>");
this.ibtToggleNavFrame.Attributes["OnClick"] =
"jsfToggleNavFrame();";
}

Nov 23 '06 #1
3 2418
Wardemon,

If you have done that, than there most be somewhere a property postback on
click set.
In my idea are the only controls that have that build in are the button and
the link button.

Cor

"wardemon" <he***********@gmail.comschreef in bericht
news:11**********************@l12g2000cwl.googlegr oups.com...
Hi All,
I would like to ask how can one resize a frame in a website w/o
postback?
My scenario is the following
I have a left frame, a top frame, and a "contents" frame.
I placed an imagebutton in the top frame that once clicked, it will
fire
a javascript code the will resize the left frame (collapse), then if
clicked again,
it will "expand" or restore the left frame's size back to its
original size.

My problem is that whenever you click the image button in the top
frame to
resize the left frame, the top frame posts back.

Is there anyway for the top frame not to postback?

Thanks,
Henry

Javascript
================================================== =========
function jsfToggleNavFrame()
{
var frame = window.parent.document.getElementById("fstMainLayo ut");
var navFrameCol = frame.cols.substr(0, frame.cols.indexOf(','));
alert (navFrameCol);
if (navFrameCol != 216)
{
frame.cols="216,*";
}
else
{
frame.cols="*,100%";
}
}
Code Behind
================================================== =========

protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetTyp e(),
"jsfUtility", "<script type='text/javascript' language='javascript'
src='./Script_Data/jsfUtility.js'></script>");
this.ibtToggleNavFrame.Attributes["OnClick"] =
"jsfToggleNavFrame();";
}

Nov 23 '06 #2

wardemon wrote:
My problem is that whenever you click the image button in the top
frame to
resize the left frame, the top frame posts back.

Is there anyway for the top frame not to postback?
..
this.ibtToggleNavFrame.Attributes["OnClick"] =
"jsfToggleNavFrame();";
}
Hi,

That happen because ImageButton is rendered in HTML element <input
type="image" ...>
that submits form on click. You can prevent its default action in this
way:
change
this.ibtToggleNavFrame.Attributes["onclick"] = "jsfToggleNavFrame();";
to
this.ibtToggleNavFrame.Attributes["onclick"] =
"jsfToggleNavFrame();return false;";

There is the different way to solve this problem:
If only functionality you need from the button is calling javascript
function then
use Image instead of ImageButton.

protected Image imgToggleNavFrame;
.........
this.imgToggleNavFrame.Attributes["onclick"] = "jsfToggleNavFrame();";

Nov 23 '06 #3
Hi Marss,
Thanks!! both worked!!

Regards,
Henry :)

marss wrote:
wardemon wrote:
My problem is that whenever you click the image button in the top
frame to
resize the left frame, the top frame posts back.

Is there anyway for the top frame not to postback?
.
this.ibtToggleNavFrame.Attributes["OnClick"] =
"jsfToggleNavFrame();";
}

Hi,

That happen because ImageButton is rendered in HTML element <input
type="image" ...>
that submits form on click. You can prevent its default action in this
way:
change
this.ibtToggleNavFrame.Attributes["onclick"] = "jsfToggleNavFrame();";
to
this.ibtToggleNavFrame.Attributes["onclick"] =
"jsfToggleNavFrame();return false;";

There is the different way to solve this problem:
If only functionality you need from the button is calling javascript
function then
use Image instead of ImageButton.

protected Image imgToggleNavFrame;
........
this.imgToggleNavFrame.Attributes["onclick"] = "jsfToggleNavFrame();";
Nov 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gordon Airporte | last post by:
I'm trying to get my canvas to resize to fill its frame within a window, but I can't figure out how to handle the callback data from the window's <Configure> properly. It has very strange behavior...
6
by: John Bowman | last post by:
Hi All, I must be missing something really obvious, so I'd appreciate someone helping me out. I have a simple Windows form that currently only has a title bar (aka the Text Property is set) and...
2
by: Mustufa Baig | last post by:
Can anybody tell me how or refer me a link where I can find the client side javascript to make the positions and resizing of the controls on .aspx page independent of screen resolution. As I am...
1
by: sam | last post by:
Hi all, Hope some expert can help me resolve this. I am using the following code to resize an iframe according to the content in it so that the iframe does not use its scroll bar and uses the...
5
by: jeanor72 | last post by:
Hi all, I'm trying to fix some javascript code to make it work also with firefox. I have the following function in a href link in a frame used to make another frame ("uno") visible or...
1
by: Nick ! | last post by:
Chris Share <usenet at caesium.me.ukwrote: http://web.cs.mun.ca/~rod/ncurses/ncurses.html#xterm says "The ncurses library does not catch signal, because it cannot in general know how you want...
3
by: pksa | last post by:
Hi, I am resizing my frame height according to the window content length but some time the scroll bar is missing, this is happening randomly, any help is greatly appreciated. Thanks in advance
1
by: hash4sp | last post by:
Hi ! I have a problem with my frame size. The frame is used to display results in form of html table generated dynamically. Sometimes the frame resizes its height according to the content in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.