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

Frames Question 2

Status
Not open for further replies.

chuckh70

Programmer
Feb 4, 2004
71
US
Hello,

I have series of pages I have written (Reports) that use a couple of list boxes to narrow the searches. I'd like to set it up so I basically have a menu of the reports on the left and when select the top populates with the list boxes and the report in the main portion. Is frames the best for this or is there another way? Also how do I get the values from the select boxes to report? I haven't been doing this long so any help would be appreciated.
 
OK I am not the HTML guru here and this is only from my experience.

To get the select box values into the report would be much easier without frames.

Then you have no strange browser issues and all you need to do is refer to controls visible directly in the local page on postback.

Using frames has several drawbacks..

it pretty well limits you to traditional asp and building tags with querystrings for certain actions..
From the webservers perspective, a page in 1 frame doesn't have access to data in another frame (it is over the internet on same strange island called browser) it needs to get the data via a query string

From the client side, menus (when used in frames) are more difficult as they tend to be limited by the size of the frame (tends to cut things off)

There are a bunch more.. but I just can't think of them right now.

I do tend to use frames to set up the headder and contents. It is nice because they tend to "hide" the real URL from the [blue](Casual)[/blue] user.

One solution is build a custom control (aspx page with all revelant code in it) and then just use it all your pages.

Develop once and use all the time..

My 1c

Rob
 
Could I use IFrame? how would that work? I have never messed with either, but the client wants a control panel feel for this. I'd prefer to just have the boxes on each page.
 
I use iframes a lot. They are much better to work with than framesets, since they are more flexible and you can put them anywhere you want them, in any size.

I'm not saying that this is the best way to do it, but I think I would do it this way.

I would put your list on the left -- it doesn't need to be in an iframe. Just reload it with the report -- you could even put in inside an "If Not IsPostBack" so it only has to load once. Your dropdowns would go in the iframe at the top so that everytime you select an item from the list it reloads the iframe and repopulates the dropdowns with a filtered list.

Then you create javascript function that loads the iframe with the page that has your dropdowns and you also pass the criteria for your where clause that filters your dropdowns.
Code:
HTML:
<select Name="mylist" onchange="loadTopFrame(this);">....

JavaScript:

loadTopFrame(obj){
   var x = obj[obj.selectedIndex].value
   myFrame.location.href = "myDropDownlistForm.aspx?criteria="+x
}

Then in the code behind of myDropDownlistForm.aspx.vb you get the criteria value:

dim val as String = Request.QueryString("criteria")

and pass it to the function that loads and filters your DropDown list:

LoadMyList(val)

....

"Select Item from MyTable where Category = '" & val & "'"

This works really great I've done it lots of times.

dpdoug

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top