Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with frame navigation in ASP.Net

Status
Not open for further replies.

GEAK

Instructor
Feb 1, 2001
90
0
0
US
I'm working on a project that mimics a tabbed dialog. I started by trying to use the Microsoft.Web.UI.WebControls TabStrip but had with horrendous results - so I'm resorting to frames.

The form I'm trying to mimic is laid out like this:
[tt][ Tab1 ][ Tab2 ][/tt]
[tt]{miscellaneous controls}[/tt]
[tt][ Tab1a ][ Tab1b ][ Tab1c ][ Tab1d ][/tt]
[tt]{additional controls within tabbed pages}[/tt]
[tt]{submit & reset buttons}[/tt]

The easiest way to explain it is the top two tabs are for creating invoices and receipts with invoices the default selected tab. The misc. controls would change when you switch from tab1 to tab2. The next row of tabs gives access to either invoice details, taxes, totals or receipt details, taxes and totals (depending upon whether invoices or receipts are selected). Finally, although similar, the submit & reset buttons differ for invoices & receipts.

My plan was as follows:
-Create three frames (header, details and footer)
-header frame would contain top tabs, header controls and bottom tabs (there's actually 5 tabs for invoice details and 6 for receipt details).
-by default the details frame would contain items but (when you click on a lower tab in the header frame) a new page would load in place of it (taxes, totals...)
-footer frame would contain buttons that correspond to the header frame. If header contains invoices then footer contains invoice buttons.

The first problem is (I think) fairly trivial but I can't seem to get past it. I thought it would be similar to changing images on a mouseover/mouseout event but...

Assuming that Tab1a is in the foreground, when I click on Tab1c it should move to the foreground, Tab1a should move to the background and controls for Tab1c should appear below it. This requires replacing the images of Tab1a & Tab1c and loading a new page into the detail frame. I thought I had code to do the last bit (loading the new page) but it appears to be intermittent. And, I can't seem to change the images.

I've laid out all the individual pages (two headers, two footers and eleven detail pages). I'm running into problems in two areas:
1. Getting the correct page to load in the correct frame.
2. Communicating data between frames.

Specifically, when you click the Receipt tab, I'm executing javascript that (I think) should load the receipt header into the header frame, receipt footer into the footer frame and receipt items into the detail frame. It does the two latter but doesn't the former: The javascript looks like this:

[tt]function SwitchToReceipts()
{
parent.frames("header").document.location = "RcptHeader.aspx";
parent.frames("detail").document.location = "RcptDetail.aspx";
parent.frames("footer").document.location = "RcptFooter.aspx";
}[/tt]

Any idea why the second and third lines will load the correct page in the correct frame but the first won't?

 
Great detailed question, however might have been too much to chew on.

I use IFRAMES and am able in .net to do this...

Sub somethin
If sender is "Bla Bla" Then
userFrame.Attributes.Add("src") = "index.aspx"
Else
userFrame.Attributes.Add("src") = "main.aspx"
End If
End Sub

dont have in front of me, but i think i declare userFrames AS HTMLGenericControl

 
You're right, I'm unnecessarily wordy :D
Hmmm... I guess that's something to bear in mind. I didn't know how to refer to frames from within the VB codebehind so I was just sticking to the javascript code.

To clarify (in case it was too much), the problem was: I'm able to load a new page into a different frame but not into the current frame (the frame where the code is being executed).

I figured out a kludge that gives the desired results: Since I want to load a new page into each frame AND the top and bottom frames (header & footer) are always paired I simply put code in the footer page to load the corresponding page into the header frame. There's a split-second lag between when you click and when the new page loads in the top frame but I can (and apparently have to) live with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top