Solved

How to create frames in ASP.NET

Posted on 2004-09-21
8
2,621 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

695 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