Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

Resizing Frame

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wardemon - 23 Nov 2006 04:11 GMT
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("fstMainLayout");
   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.GetType(),
"jsfUtility", "<script type='text/javascript' language='javascript'
src='./Script_Data/jsfUtility.js'></script>");
       this.ibtToggleNavFrame.Attributes["OnClick"] =
"jsfToggleNavFrame();";
   }
Cor Ligthert [MVP] - 23 Nov 2006 06:14 GMT
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

> Hi All,
>  I would like to ask how can one resize a frame in a website w/o
[quoted text clipped - 45 lines]
> "jsfToggleNavFrame();";
>    }
marss - 23 Nov 2006 09:10 GMT
>   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();";
wardemon - 23 Nov 2006 14:26 GMT
Hi Marss,
 Thanks!! both worked!!

Regards,
Henry :)

> >   My problem is that whenever you click the image button in the top
> > frame to
[quoted text clipped - 27 lines]
> ........
> this.imgToggleNavFrame.Attributes["onclick"] = "jsfToggleNavFrame();";

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.