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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

frames and switching pages... a related query!

Status
Not open for further replies.

kubu

Programmer
Jan 10, 2001
23
US
My question is similar to those posed by gd082 on 4/22, but I still need a bit more info.

Here's my scenario: The main page of my WebForms app contains a frameset with three dynamically-loaded frames -- one for a page header, one that points to a WebForm with a TreeView control, and one that will display contents. When the user clicks on a tree node, I'd like use that event to load the appropriate page into the third frame. It seems that I need to somehow send a message from the page with the TreeView control to the page containing the frameset, so that the frameset page can decide which page to load in the third frame.

Problem is, how? I'm stumped! I know (from the answers to gd082's post) that I might be able to incorporate Javascript to do this, but I'd really like to stick with VB.NET code if possible. However, I can't seem to find anything in VB that relates to to Javascript's "parent.frame[].location" syntax.

Thanks!
Mark
 
Hey kubu,

Here's how we did it:

The tree view control has teh ability to databind to various sources. One of the sources is an XML file. What we did was create an xml file that has the node structure built in. Part of the attributes we gave to each node was a target = " " and a NavigateURL = " "
In the target, we would say "main" or whatever your third one is. In the NavigateURL, we'd put whatever the file was and the path.

Then, in visual studio, we set that file to the TreeNodeSrc property, and in the code behind for the page load we did a TreeView.DataBind

So now, when our tree view loads, all the user has to do is click on one of the nodes, and without javascript or base tags or anything else, the new page opens up in the right frame.

We've also create a way to, via the web, re-generate the xml file if any changes are made to the node structure, so its very dynamic.

I hope this helps. If you have any other questions, just ask.
:)

Jack
 
Mark,

We build the treeview dynamically, and in the NavigateURL put something like this:

javascript:parent.frames[1].location.href=yourURL;

Another option, as mentioned in the html source for a new frameset created with visual studio, would be
3. Add a BASE target="main" element to the HEAD of
your "header" page, to set "main" as the default
frame where its links will display other pages.

Neither is the VB solution you're looking for, but hopefully one will be suitable.

Good luck!
TealWren
 
Thanks to both of you! This gives me a few more avenues to explore. I'll be sure to keep you updated on my progress.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top