[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2628
  • Last Modified:

How to create frames in ASP.NET

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
protugy
Asked:
protugy
  • 4
  • 2
  • 2
1 Solution
 
deepaknetCommented:
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
 
protugyAuthor Commented:
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
 
deepaknetCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LindzKCommented:
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
 
LindzKCommented:
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
 
protugyAuthor Commented:
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
 
LindzKCommented:
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
 
LindzKCommented:
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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now