Dear sir,
I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser ,
using ,
string str=directory.g etfiles("");
response.conten tType="text/html";
response .writefile("");
it displayed in different format and images not shown
blank spaces shown as ?????????? and image as X.
i have no. of files stored as word file ,tried to display directly in gridview but it's not posible for me, so i converted them as web page and now i want to display 5 files dynamically in gridview including images., so help me out, looking for ur reply..
, can u tell me how it works, i will be thanxfull to u
i do not want to use web browser or process.start(" IExploreAsassr. exe","path") method because it displays only one file at a time , actually i want to dislay it in gridview item template, including pics.
23 19143
well, you can use <iframe> tag - <iframe src ="myFilePath.html" width="100%" height="300">
-
<p>iframes not supported</p>
-
</iframe>
in response.write( "") pass parameter for showing the iframe tag with the desired file...
cheers,
Nitin
- <html>
-
<head>
-
<meta http-equiv="Content-Type" content="application/doc">
-
</head>
-
<body>
-
<iframe src="your-word-document-file.doc" width="100%" height="100%"> </iframe>
-
</body>
-
</html>
try this.
Frinavale 9,735
Recognized Expert Moderator Expert
Hi Shashi,
Have you tired viewing the HTML webpages generated by Word by themselves first?
Make sure that they display correctly before trying to use them in your asp application.
If they are working, consider using IFrames to display the webpages in the grid.
i am really respectfull to u all for ur reply, i want to use like this shown as below, -
-
<div>
-
<iframe id="iframe1" runat="server" scrolling="auto" width="100%" height="100%"> </iframe>
-
-
</div>
-
string[] getfile = Directory.GetFiles(@"D:\Shekhar Documents", "*.htm");
-
for (int i = 1; i < getfile.Length; i++)
-
{
-
HtmlControl frame = (HtmlControl)this.FindControl("iframe1");
-
//string path = Server.MapPath("1.htm");
-
frame.Attributes["src"] = getfile[i];
-
}
i am using this but it not displayed my file content, it only displayed http url.. like "http://www.google.com" , please help me out.. i am waiting for ur reply.
try displaying only single file on the page @shashi shekhar singh
Like
frame.Attribute s["src"] = getfile[i];
I am giving
frame.Attribute s["src"] = "D://shekhardocument s/1.htm";
then it's not displaying , am new for iframe so plzgive me reply.
Frinavale 9,735
Recognized Expert Moderator Expert @shashi shekhar singh
Ok, that wont work, your 1.htm file has to be located on the web server. That way web browsers can down load it using the URL specified as the src attribute.
You can't use a local file path to the 1.htm file...you have to use something like "http://localhost/mywebsite/statichtm/1.htm".
So, place all of the htm files into a folder located within your project. Then loop through the directory and create the URL based on the files you find there.
So you would have something like this to create the URLs: -
string[] getfile = Directory.GetFiles(Server.MapPath("~/statichtm/"), "*.htm");
-
List<string> staticHtmUrls= new List<string>();
-
-
for (int i = 1; i < getfile.Length; i++)
-
{ string staticURL = "/statichtm/"+getfile[i];
-
staticHtmUrls.Add(staticURL );
-
}
So now you have a list of URLs to your static htm files.
I'm thinking that it will probably be easier for you to use a Repeater instead of a GridView.
So your ASP code would look like: -
<asp:Repeater ID="staticWebPagesRepeater" runat="server">
-
<HeaderTemplate>
-
<table border="1">
-
<tr>
-
<td><b>Web Pages</b></td>
-
</tr>
-
</HeaderTemplate>
-
<ItemTemplate>
-
<tr>
-
<td> <iframe src="<%# Container.DataItem %>"></iframe></td>
-
</tr>
-
</ItemTemplate>
-
<FooterTemplate>
-
</table>
-
</FooterTemplate>
-
</asp:Repeater>
And your C# code would have something like this: -
private List<string> _repSource;
-
protected void Page_Load(Object sender, System.EventArgs e)
-
{
-
_repSource = new List<string>();
-
string fileNames[] = Directory.GetFiles(Server.MapPath("~/StaticHTM/"), "*.htm");
-
foreach (string name in fileNames)
-
{
-
string sp[] = name.Split('\');
-
string urlToStaticHTML = sp(sp.Length - 1);
-
_repSource.Add("/StaticHTM/" + urlToStaticHTML );
-
}
-
staticWebPagesRepeater.DataSource = _repSource.ToArray();
-
staticWebPagesRepeater.DataBind();
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dale zhang |
last post by:
Hi,
I build a web form with a 4-cell table on the top (flawlayout), followed by
some labels and textboxes (gridlayout). The web form is displayed well in
dell m60 laptop with all resolution options and DPI options. However when I
tried to run it in a dell P3 desktop, labels and textboxes overlapped each
other and they were in table area too.
Any suggestions? Do I have to put all controls in table cells?
|
by: Tina |
last post by:
I'm in a button clicked event on mainpage.aspx. I want to display a new
webpage that has just my image, which is a jpg. I want the page to be a
..jpg not an aspx so that it will be easy for the user to save to disk.
How can I do this?
Thanks,
T
|
by: Rob Meade |
last post by:
Hi all,
I have just put together our organisations 'template' for our web
applications and have created 7 .ascx files which when dropped into my
template file work perfectly...however, I have a question...
As our team develops several applications I wanted these generic .ascx's to
be able to be used by all - therefore I've placed them in the root of the
domain we work on in a directory called /WebUserControls
|
by: David Elliott |
last post by:
I need a control on a Web Page that can accept an HTML Document and will display it.
Any help would be appreciated.
Thanks,
Dave
Here is what I was trying...
|
by: Oleg |
last post by:
I have a web form let's say 'YYZ.aspx'.
It has an iframe in it.
When it loads it shows progress bar in IE this way: loading for page then
again loading for page in iframe.
This part is fine.
Problem is when I put page 'YYZ.aspx' in iframe of another page, let's say
'Home.aspx'.
In short: (page (page in iframe(page in iframe) ) )
Progress bar shows ones (fast), then second time(kind of fast) and then
third time. And this time it never...
| |
by: Alan Silver |
last post by:
Hello,
In classic ASP, I used to use two include files on each page, one before
and one after the main content, to provide a consistent layout across a
web site. That way I could just change the include files to change the
layout. When I came to ASP.NET, I used user controls to do a similar
thing.
I have just been looking at master pages, and it looks like they do the
same thing. If so, is there any advantage in using them over the...
|
by: Peter Lapic |
last post by:
I have to create a image web service that when it receives an imageid
parameter it will return a gif image from a file that has been stored on the
server.
The client will be an asp.net web page that calls the web service to render
a vertical strip of images.
After doing some research I am unable to find some vb.net code that can
assist in what I want to achieve.
The closest thing I found was
|
by: c676228 |
last post by:
Hi everyone,
I have a piece of code in sales.aspx.vb like this:
Protected WithEvents Message As System.Web.UI.WebControls.Label
Try
...
ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr + "&ChartType=" +
drpChartType.SelectedItem.Value.ToLower() + "&Print=" +
printVersion.ToString()
...
Catch e As Exception
|
by: tomhawkins1 |
last post by:
Hi
I currently have a site where users can upload files. These files can
be doc, wmv, jpeg, xls, dwf, dwf and dwg.
These files are uploaded to /home/**user**/uploads and not /home/
**user**/public_html/uploads to prevent any old user from browsing
them.
I then use a general showDoc page with the following function (from
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |