Hi,

I have a web application(made in ASP.NET ) which displays excel document(or other kind of document) in a frame by using Response.Redirect(@"some path../Excel1.xls", true);
My problem is that when i open 2 excel document one after the other.The second excel document seems to be corrupted. When i click on the excel tab(to go to different worksheet).
The tab vanishes!! This problem does not happen when i open say a jpg image file in between 2 excel files.


Bye.

Hi All,

I have created a small demo web application for you all to see the bug.
The start page is frameset.htm.

To reproduce the error, click on the Excel1(Hyperlink button) and then Excel2(Hyperlink button2)
(these button will displays excel documents one after another). You will see the bug in the second excel document.

If you instead click Excel1,Image(Hyperlink button which displays image) and then Excel2. This bug will not be found.

Here are the codes:
FrameSetPage.htm (This is the start page)

<frameset name="fr_main" id="fr_main" rows="*,50%"      frameborder="1">
		<frame name="fTop" id="fTop"    src="FrameTop.aspx" frameborder="1" >
		<frame name="fBottom" id="fBottom"   frameborder="1" >
	</frameset>

FrameTop.aspx

<form id="form1" runat="server">
        <asp:HyperLink ID="LinkButton1" runat="server">Excel1</asp:HyperLink>
                <asp:HyperLink ID="LinkButton2" runat="server">Image</asp:HyperLink>
                        <asp:HyperLink ID="LinkButton3" runat="server">Excel2</asp:HyperLink>
      
    </form>

FrameTop.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        
        LinkButton1.NavigateUrl = "FrameBottom.aspx?id=1" ; 
        LinkButton1.Target = "fBottom";
        LinkButton2.NavigateUrl = "FrameBottom.aspx?id=2";
        LinkButton2.Target = "fBottom";
        LinkButton3.NavigateUrl = "FrameBottom.aspx?id=3";
        LinkButton3.Target = "fBottom";
        
    }

In FrameBottom.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        string id=Request.QueryString["id"] ;
        OpenExcel(id);
    
    }

    private void OpenExcel(string id)
    {


        if (id == "1")
        {
            //use your own localhost : port no

            Response.Redirect(@"http://localhost:23265/TestProject/TempFiles/Excel 1.xls", true);


        
        }
        else if (id == "2")
        {
            Response.Redirect(@"http://localhost:23265/TestProject/TempFiles/fiber.bmp", true);
            


        }
        else
        {


            Response.Redirect(@"http://localhost:23265/TestProject/TempFiles/Excel 2.xls", false);

        }
        

    }

Create a folder also call TempFiles which contain excel documents(with multiple worksheet).

Thanks,
Bye.

This article has been dead for over six months. Start a new discussion instead.