Results 1 to 3 of 3

Thread: How can i use Frameset in asp.net

  1. #1
    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.

  2. #2
    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    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.

Similar Threads

  1. How to use Frameset Tag in HTML?
    By MELTRONICS in forum Software Development
    Replies: 6
    Last Post: 29-01-2010, 05:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,385,311.49318 seconds with 16 queries