473,789 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retieve InnerHTML from an IFrame on the Server Side.

Has anyone had any success doing this. I have tried, but the InnerHTML
property always comes back as an empty string.

L Anthony Johnson
Nov 18 '05 #1
4 5141
This information is not sent back to the server. You would have to use
Javascript to place an IFrame's InnerHTML in an HTML Hidden Input tag and
read it that way.

Alex Papadimoulis

"L Anthony Johnson" <pp*****@nospam m4m3bellsouth.n et> wrote in message
news:uA******** ******@tk2msftn gp13.phx.gbl...
Has anyone had any success doing this. I have tried, but the InnerHTML
property always comes back as an empty string.

L Anthony Johnson

Nov 18 '05 #2
I am doing the following. However whenever the text in the IFRame (ifrHTML)
has any type of formatting other than plaintext, the innerHTML is not
returned.

If I do a CTRL+B (bold) or CTRL+U (Underline) or any other formatting. The
cmdSend_Click routine is not entered. That is what puzzles me.

~~~~~~~~~~~~
WEBFORM
~~~~~~~~~~~~
<HTML>
<body>
<form id=frmMain method=post runat="server">
<iframe id=ifrHTML name=ifrHTML ></iframe>
<asp:Button id=cmdSend runat="server" Text="Send"></asp:Button>
<input type=hidden name=hidValue>
</form>
<script>
//Set the IFRame to Design Mode.
ifrHTML.documen t.designMode="o n"
</script>
</body>
</HTML>

~~~~~~~~~~~~
CODE BEHIND.
~~~~~~~~~~~~
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
cmdSend.Attribu tes.Add("onClic k",
"document.frmMa in.hidValue.val ue = ifrHTML.documen t.body.innerHTM L;")
End Sub

Private Sub cmdSend_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdSend.Click
Try
Dim strValue As String
strValue = Request.Form("h idValue")
Catch ex As Exception
Throw New Exception(ex.To String())
End Try
End Sub

L Anthony Johnson

"Alex Papadimoulis" <alexp-at-halogenstudios. com> wrote in message
news:uN******** *****@tk2msftng p13.phx.gbl...
This information is not sent back to the server. You would have to use
Javascript to place an IFrame's InnerHTML in an HTML Hidden Input tag and
read it that way.

Alex Papadimoulis

"L Anthony Johnson" <pp*****@nospam m4m3bellsouth.n et> wrote in message
news:uA******** ******@tk2msftn gp13.phx.gbl...
Has anyone had any success doing this. I have tried, but the InnerHTML
property always comes back as an empty string.

L Anthony Johnson


Nov 18 '05 #3
What I do is have my IFrame send a javascript method call to it's parent
(the Page). The page holds the function to receive this call, and displays
something accordingly. Whatever information it needs is passed via arguments
to the function.
"L Anthony Johnson" <pp*****@nospam m4m3bellsouth.n et> wrote in message
news:eJ******** ******@tk2msftn gp13.phx.gbl...
I am doing the following. However whenever the text in the IFRame (ifrHTML) has any type of formatting other than plaintext, the innerHTML is not
returned.

If I do a CTRL+B (bold) or CTRL+U (Underline) or any other formatting. The cmdSend_Click routine is not entered. That is what puzzles me.

~~~~~~~~~~~~
WEBFORM
~~~~~~~~~~~~
<HTML>
<body>
<form id=frmMain method=post runat="server">
<iframe id=ifrHTML name=ifrHTML ></iframe>
<asp:Button id=cmdSend runat="server" Text="Send"></asp:Button>
<input type=hidden name=hidValue>
</form>
<script>
//Set the IFRame to Design Mode.
ifrHTML.documen t.designMode="o n"
</script>
</body>
</HTML>

~~~~~~~~~~~~
CODE BEHIND.
~~~~~~~~~~~~
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
cmdSend.Attribu tes.Add("onClic k",
"document.frmMa in.hidValue.val ue = ifrHTML.documen t.body.innerHTM L;")
End Sub

Private Sub cmdSend_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdSend.Click
Try
Dim strValue As String
strValue = Request.Form("h idValue")
Catch ex As Exception
Throw New Exception(ex.To String())
End Try
End Sub

L Anthony Johnson

"Alex Papadimoulis" <alexp-at-halogenstudios. com> wrote in message
news:uN******** *****@tk2msftng p13.phx.gbl...
This information is not sent back to the server. You would have to use
Javascript to place an IFrame's InnerHTML in an HTML Hidden Input tag and read it that way.

Alex Papadimoulis

"L Anthony Johnson" <pp*****@nospam m4m3bellsouth.n et> wrote in message
news:uA******** ******@tk2msftn gp13.phx.gbl...
Has anyone had any success doing this. I have tried, but the InnerHTML property always comes back as an empty string.

L Anthony Johnson



Nov 18 '05 #4

Hi Anthony,

Did you find a solution for this, I'm struggling with the same proble
(creating a Content Management System), whenever I post the form an
run a 'SaveData' procedure, the innerHTML is retrieved as the initia
value, so all the editing done by the visitor is discarded....

Cheers,

Michael van den Berg
Holland
L Anthony Johnson Wrote:
Has anyone had any success doing this. I have tried, but the InnerHTML
property always comes back as an empty string.

L Anthony Johnso


--
Michael van den BergPosted from http://www.pcreview.co.uk/ newsgroup acces

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
21634
by: Soren Vejrum | last post by:
I am working on a web-based html editor using MSIE's designmode and iframes. Everything works just fine, but MSIE changes all my relative "a href" and "img src" links (i.e. "/index.asp") to absolute links (i.e. "http://localhost/index.asp") when I set the iframe's innerHTML. This is bad as the links are supposed to be relative. How can I avoid this? Any solutions/suggestions are much appreciated.
4
8915
by: JimMenees | last post by:
(code is at end of post) ------------------------------------------- I'm using an i-frame to grab a server-side text file and display its content elsewhere in the html document. On change of the i-frame source, I want to access its innerHTML. The i-frame source changes just fine and even displays the source; the glitch is in accessing the innerHTML for that new i-frame src file. It requires *TWO* clicks of the onClick element to get...
3
8140
by: Angel | last post by:
How do I get the reference of the IFrame from the asp.net webpage that is being displayed within that IFrame? In other words I have an IFrame in my page. Within that IFrame Set the source to a different asp.net page. I want on that page that is within the IFrame to be able to access the IFrame object. How can that be done? Besides the reference to the IFrame but also certain other objects that are in the Host page of the Iframe. thanks...
22
2380
by: Chris Moltisanti | last post by:
Hey, I have a DIV and I want to dynamically set its innerHTML. I know I can set it by doing the following myDiv.innerHTML = '<img src=\"myImage.gif\">' However, the html that I want to set in it is quite large so I dont want to have to hard code the HTML like I just did. My question is....is it possible to assign an existing html page to the innerHTML. e.g. myDiv.innerHTML = 'mytest.html'
6
10555
by: howa | last post by:
Since it is part fo the standard, why I always heard that we should avoid iframe? any comments? thanks.
5
1908
by: Andrew Hedges | last post by:
Wherein I attempt to debunk some myths about the relative merits of the two methods for programmatically adding content to a web page: http://www.newfangledtelegraph.com/blog/entry/the-need-for-speed-innerhtml-versus-dom-manipulation/ Cheers, -Andrew ----- andrew@hedges.name / http://andrew.hedges.name/
6
2622
by: honguin | last post by:
Hi, The current scenario is that I have an iframe inside an asp.net web page where I periodically check the url inside the iFrame. I know that all this information can be obtained in the client-side during a page load. Does anyone know an efficient way to obtain the current url of the src attribute of the iFrame? Or if there is a better solution? Many thanks
22
9527
by: Aaron Gray | last post by:
How do I set the innerHTML property of a contained IFRAME ? Many thanks in advance, Aaron
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
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...
1
10139
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,...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
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
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.