Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 17-04-2009
Member
 
Join Date: Dec 2008
Posts: 61
idea How can i use Frameset in asp.net

Hey Guys,

I would like to know that how do i use HTML Frameset in asp.net. I would like to add three .aspx pages in a single web page. So, that each web page would work separately. Is it possible for me to do so? Does any body knows about it? Kindly provide me the correct logical solution for the above issue. Any kind of information on the above issue would be appreciated.

Thanks a lot.
Reply With Quote
  #2  
Old 17-04-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: How can i use Frameset in asp.net

The process is simple. For this you need to have 3 aspx pages.

1.0 Index Page containing the 2 frames. (Eg: Index_Frame.aspx)
2.0 Content Page containing the buttons (Eg: Content.aspx)
3.0 Target page to get the result of button click (Eg: Main.aspx)

Let me give you the steps.

In the Index Page create two frames each with content.aspx source and main.aspx source
In the form tag of Content.aspx add a attribute as target="Main" , where 'Main' is the name of the second frame. (i.e. which contains Main.aspx)

I have given the sample codes for all the three aspx files.

1.0 Index.aspx
Code:
<html>
<head>
<title>Index_Frame</title>
</head>
<frameset cols="30%,*">
<frame name="Content" src="Content.aspx" frameborder=1/>
<frame name="Main" src="Main.aspx" frameborder=1 />
</frameset>
</html>
2.0A Content.aspx

Code:
<HTML>
<HEAD>
<title>Content</title>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server" target="Main">
<asp:Button id="Button1" runat="server"
Text="Open Yahoo Page" Width="224px"></asp:Button>
<br><br>
<asp:Button id="Button2" runat="server"
Text="Open DotNet Spider Page" Width="224px"></asp:Button> 
</form>
</body>
</HTML>
2.0B Content.aspx.cs

In the code behind of Content Page add the following methods to redirect to respective pages.

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://www.yahoo.com");
}

private void Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://dotnetspider.com");
}


3.0 Main.aspx

Code:
<!--This is just a blank web form--!>
<html>
<head><title>Main</title></head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server"></form>
</body>
</html>

Hope this may help you out.
Reply With Quote
  #3  
Old 17-04-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: How can i use Frameset in asp.net

You should avoid frames at all costs. Try using server requests. Also, you can use placeholders and change which file is included depending on which request is made. This way when the page is requested the placeholder uses the requested include. This can be done on server side.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How can i use Frameset in asp.net"
Thread Thread Starter Forum Replies Last Post
How to use Frameset Tag in HTML? MELTRONICS Software Development 6 29-01-2010 05:46 PM


All times are GMT +5.5. The time now is 11:09 PM.