1
Reply

Opening Ms Word Document in asp.net

suresh

suresh

Jan 26 2012 2:24 PM
2.5k
Hi,
My web page contains two button i.e
Collapse | Copy Code
<asp:button id="btnOpenword" runat="server" text="OpenFile">
<asp:button id="btnNext" runat="server" text="Next" visible="false">

when i click on the OpenFile Button i need to open the word document and also below the Next button should visible to the user.
so i write some code but it's working to open the word document, but it's not visible the Next button to the user.
Collapse | Copy Code
btnNext.Visible = true;
FileInfo file = new FileInfo("filename.doc");
Response.ClearContent();
Response.AddHeader("Content-Disposition", "inline;filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/msword";
Response.TransmitFile(file.FullName);
Response.End();

Plese give me solution it's urgent.
or is there any way to do..
Thanks ,
Suresh

Answers (1)