Solved

How to create frames in ASP.NET

Posted on 2004-09-21
8
2,613 Views
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.

thanks.

TJ
0
Comment
Question by:protugy
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Expert Comment

by:deepaknet
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.
0
 

Author Comment

by:protugy
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.

thanks.

TJ
0
 
LVL 15

Expert Comment

by:deepaknet
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">
</frameset>
0
 
LVL 5

Expert Comment

by:LindzK
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Accepted Solution

by:
LindzK earned 125 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>
0
 

Author Comment

by:protugy
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.

thanks.

TJ
0
 
LVL 5

Expert Comment

by:LindzK
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">
<html>
<head>
<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">
</head>
<frameset cols="150,*">
      <frame name="contents" src="Menu.aspx">
      <frame name="main" src="WebForm1.aspx">
<noframes>
<pre id="p2">
================================================================
INSTRUCTIONS FOR COMPLETING THIS CONTENTS FRAMESET
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.
================================================================
</pre>
<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.
</p>
</noframes>
</frameset>
</html>

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 :)





0
 
LVL 5

Expert Comment

by:LindzK
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
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now