Hi,
I'm a beginner in ASP.net.
I have an ASP.net page in which I'd like to display another html page in a div. I have the file WeeklyReturns.html together with its associated folder WeeklyReturns(containg images to be rendered with the page) located in a virtual path (~/UploadFiles) in
the project root folder. When I right-click to browse WeeklyReturns.html, the page is perfectly rendered in IE or Firefox.
And so I expect the following VB.net click event code (of a button) to display the html in a div on my parent ASP page:
Why you don't insted trying to fill the div with html content to put iframe inside of this div and set the iframe src="" url (make the iframe server control adding id="myid" runat="server").
Cheers
Please, don't forget to mark as "Answered" if it helped you. Thanks.
JubileeICT
0 Points
1 Post
div.InnerHTML
Jan 04, 2013 08:45 PM|LINK
Hi Folks,
Hi,
I'm a beginner in ASP.net.
I have an ASP.net page in which I'd like to display another html page in a div. I have the file WeeklyReturns.html together with its associated folder WeeklyReturns(containg images to be rendered with the page) located in a virtual path (~/UploadFiles) in the project root folder. When I right-click to browse WeeklyReturns.html, the page is perfectly rendered in IE or Firefox.
And so I expect the following VB.net click event code (of a button) to display the html in a div on my parent ASP page:
Me.divHTML.InnerHTML = System.IO.File.ReadAllText(Server.MapPath("~/UploadFiles/WeeklyReturns.html"), Encoding.Default)
Unfortunately, nothing is displayed; I've tried several experiments with InnerText, Encoding.???, all to no avail.
Could someone pls offer some solution.
Stoian Bucov...
Participant
1685 Points
265 Posts
Re: div.InnerHTML
Jan 05, 2013 02:57 AM|LINK
Hola,
Why you don't insted trying to fill the div with html content to put iframe inside of this div and set the iframe src="" url (make the iframe server control adding id="myid" runat="server").
Cheers
senthilwaits
Contributor
3832 Points
651 Posts
Re: div.InnerHTML
Jan 05, 2013 03:13 AM|LINK
You can use jQuery to achieve this. But make sure, you don't have HTML, BODY and HEAD tags in your HTML page just the content of the BODY.
$.get('test.html') .success(function(data) { $('#YourDivID').html(data); });Please refer
http://stackoverflow.com/questions/8849668/load-external-html-file-to-div-using-jquery
http://stackoverflow.com/questions/3432553/how-to-load-replace-an-entire-div-from-an-external-html-file
Senthil Kumar Sundaram