Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2003, 06:26 AM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hyperlink in asp.net

I've got a htm frame page with 2 aspx pages(main and left) in the frames. I've got a server-control button on main. When I press this button the left frame(left.aspx) must change to (left2.aspx). In other words. I taget the left frame from the main frame, to chage that the left page. How can I do that. Remember it must be vb.net code.:)

I've tried server.transver(left2.aspx), but it only change the main frame to left2.aspx

Please help, beg you.

Jaco
 
Old September 19th, 2003, 11:39 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Is there a necessity to generate a postback for this button? Is the button doing anything other than changing the location of the page in the other frame? If that's the case than you needn't use a server control button. You should just use a regular button input in the HTML of your ASPX and write the javascript to change the href location of the other frame.

Alternatively you can have the asp:button click event register a startup script which contains the same javascript that the client-side button click would have had.

RegisterStartupScript("<script language=""javascript"">leftFrame.location.href='l eft2.aspx';</script>")


Peter
 
Old September 19th, 2003, 12:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hmmmm, yes? AFAIK, the startup script fires as soon as the page has loaded (well, just before that).

IMO, you should add the click handler to the button directly using its Attributes collection:


Button1.Attributes.Add("onclick", "parent.frames['leftNav'].location.href='page2.aspx';")

This adds an additional click handler to the button that will run before the page gets submitted.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old September 22nd, 2003, 08:53 AM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help auks.
To Imar: I did use the attributes command but I used "onmouseUp" key
To Planoie: My button does a athentication and then redirect to the left2.aspx. I tried your java code, but I cant get it working, because I use more than 2 frames: Top, 3 in the middle and a footer frame. So if I say leftframe, it reload the most left one. So I cant specify a frame by its name, or can I?

Tankx again

Jaco
 
Old September 22nd, 2003, 09:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, yes you can. LeftFrame is not necessarily the frame at the left, but it's a frame called LeftFrame.

In your frameset, you can give each frame a name, so it's accessible by code. If you have nested frames, you'll need to provide the nested name as well, something like:

parent.MainFrame.SubFrame

or

parent.frames['MainFrame'].frames['SubFrame']

I suggest you post the code for your frameset so we can take a look at it.


Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 27th, 2003, 03:41 PM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hallo,

Also new to all this.
What would the synax be for the above using C#?

I am also trying to change a second frame to a different page.
I'm using frames to prevent the whole page from redrawing each time.

Is there a better way to do this?

Cheers!

Mike B

 
Old November 28th, 2003, 07:15 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by mbarham
I'm using frames to prevent the whole page from redrawing each time.

Is there a better way to do this?
If you want to be more browser compatible you should use frames. Otherwise, you could use IFrames, which are a IE specific HTML tag (at least for now).

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:hyperlink in repeater visibility spinout ASP.NET 2.0 Basics 11 February 27th, 2008 08:51 AM
Hyperlink in asp page ppenn Classic ASP Databases 2 September 27th, 2007 02:09 PM
( C# in ASP.NET ) can a hyperlink call a function? richie86 ASP.NET 1.0 and 1.1 Basics 0 November 5th, 2005 01:25 AM
asp.net hyperlink problem brettdavis4 General .NET 9 November 10th, 2004 11:40 AM
ASP:Hyperlink problem widad Classic ASP Basics 3 September 23rd, 2004 10:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.