How to create frames in ASP.NET

Posted on 2004-09-21
Medium Priority
Last Modified: 2009-07-29
Hi Experts,

I'm currently using VB.NET for my aspx file. I'd like to create frames for my page so that one frame will maintain the state of the browser. For examples, Let's say I have a logo of my company and some menus on the top of the page. No matter what page a user navigates to, I want the user to always see the logo and the menu. In other words, only the frame below is linked to another aspx file. The top frame will remain the same.

Any help will be appreciated.


Question by:protugy
  • 4
  • 2
  • 2
LVL 15

Expert Comment

ID: 12110363
Frames is nothing but plain vanilla HTML. You can manage your frameset as simple as in the case of Ordinary HTML page.

Managing a frameset has a restricted support from HtmlGenericControl class from CodeBehind.

Author Comment

ID: 12110376
Well, managing a frame maybe is a next step for me. For the time being, I just want to create one.

I do not see a Web Form control nor an HTML control in .NET Web Matrix. How do I include it in the same page?

 Basically, what I want to do is create a web app that similiar to older sites - when a user clicks on an icon, a different web page gets loaded into a frame rather then an entire new page appearing.


LVL 15

Expert Comment

ID: 12110409
It is simply the same old classic HtML Tags TJ:

<frameset rows="20%,*">
   <frame src="" id="test" name="test">
   <frame src="" id="test2" name="test2">
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


Expert Comment

ID: 12112380
If you need some help with the creating of it - in your solution explorer - if you click on your project name and select 'add new item'.

You can pick a frame page from the options in there.

That then takes you through a little wizard, to produce the type of frameset that you want.

Accepted Solution

LindzK earned 500 total points
ID: 12112422
As for the clicking on something in one frame, and opening a different page in another

if you use hyperlinks for the user to click on, you can drag and drop a hyperlink from the webforms section of your tool box, and then in properties

set the navigateUrl to the page that you wish to open in the other frame window.
and set the target property to = the name of the frame you wish to open it in.

Or, if you'd rather use code to produce it - in the html version of the form designer you would do something like

<a href="mypage.aspx" target="framename">Click here to open mypage, in the frame to the right of me</a>

Author Comment

ID: 12115194
Ok.. One more question.. How can I use the information on one frame and pass it to the other? What class do I need to use? Is it Http class? Any example will be very helpful.



Expert Comment

ID: 12120735
The easiest way to do it, is to use a hyperlink with a target - either a asp.net control hyperlink, or just hard code it yourself in the html page of the 'menu' page.

Lets imagine you followed my example to create a frame set - so you should ( in the html view of the frame set), have some code that looks like the following :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<title>Contents Frameset</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<frameset cols="150,*">
      <frame name="contents" src="Menu.aspx">
      <frame name="main" src="WebForm1.aspx">
<pre id="p2">
1. Add the URL of your src="" page for the "contents" frame.
2. Add the URL of your src="" page for the "main" frame.
3. Add a BASE target="main" element to the HEAD of your
      "contents" page, to set "main" as the default frame  
      where its links will display other pages.
<p id="p1">
This HTML frameset displays multiple Web pages. To view this frameset,
use a Web browser that supports HTML 4.0 and later.

You now have two frames, one called contents - one called main.

I added two pages in the src of the frames, one called menu.

Inside menu.aspx - you can either drag and drop a webform hyperlink onto your page from the toolbox in the ide, and fill in the location and target in the properties window.  The target would be 'main' as that's the frame where you want your main stuff to appear away from the menu.

Otherwise, you can open up menu.aspx in html view - and just simply type hyperlinks in manually, with a target

such as

<a href="WebForm2.aspx" target="main">Click here for second item</a><br>
<a href="WebForm3.aspx" target="main">Click here for third item</a><br>

Which ever way you do it - when the user clicks on the links, in the left hand frame, a new page will open in the right hand side.

Inside each frame in your frameset - you can use any type of page you want - html page, aspx page etc.

Does this help? or do you need more explanation still :)


Expert Comment

ID: 12121451
aah sorry - didn't read your question properly.

you pass information as parameters in the url

http://www.mypage.aspx?myvalue=this is the value

you retrieve it in your code behind module using the request object

Dim value as string  = request.Item("myvalue")

the full class information of a request is this

Public ReadOnly Property Request() As System.Web.HttpRequest
     Member of: System.Web.UI.Page

but you only need to reference request, as the classes it belongs to are already registered in your aspx page

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Now many of you may wonder how you can reach great design with least number of essentials. Isn’t stuffing ‘more and more number of elements that speak for the purpose’ the right way to do it? Erm, not always, and in this write-up, you will see why.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question