how to get the innerHtml from iframe in C# ?
-
First you have to get document object for the IFRAME. Then Use innerHTML property to get it. See the following eg:
var TxtEditor = document.getElementById('IFrameId').contentWindow.document;
alert(TxtEditor.body.innerHTML)
-
First you have to get document object for the IFRAME. Then Use innerHTML property to get it. See the following eg:
var TxtEditor = document.getElementById('IFrameId').contentWindow.document;
alert(TxtEditor.body.innerHTML)
-
Make a hidden
textbox
run at server. GetIFRAME
value using javascript, and assign to this textbox. Since your hidden textbox is a server control, you have access to it from code behind.
-
Your question isn't clear enough! Are you hosting a web control in a WinForm application written in C#? Are you hosting a web control in a WPF application written in C#? Are you using C# as a client side scripting language in the browser? Are you writing an ASP.NET page in C# and want to see what the client has in the IFrame (nope, not possible, but it might still be what you are looking for so I included it)? Are you accessing a web server from C# and want to extract the HTML from the web server response? I am sure there are more possibilities, but this is what I could come up with as I typed, so you probably need to add some details on what you are doing and what you try to achieve.
-
Make a hidden
textbox
run at server. GetIFRAME
value using javascript, and assign to this textbox. Since your hidden textbox is a server control, you have access to it from code behind.
//Make a hidden textbox run at server. Get IFRAME value using javascript, and assign to this textbox. very good ~ but ,it also have problems ~ I have got the method that get value of iframe and assigned it to TextBox, but when run the method to do this ? it required a Event,a suitable Event,the Iframe haven't got those Events,for example:onkeyup,onkeydwon,onchange,onpropertychange...,and in this section it haven't got a
or the other control like to occur. In other way , there's a user control with two properties:Text and Content. when using the user control ,we just see the Content property is ok , the Content property's value is the iframe's innerHtml,Now i know how to get innerHtml in javascript ,but i don't know how to use it in codebehind ?! the former said "..and assign to this textbox...",It request a suitable Event to do that , for there's no Form label,No button , only a button is in another page that use the user control,when it clicked we must show the user control's property ~ how ever , I do not like this method... thank you very much !
-
Your question isn't clear enough! Are you hosting a web control in a WinForm application written in C#? Are you hosting a web control in a WPF application written in C#? Are you using C# as a client side scripting language in the browser? Are you writing an ASP.NET page in C# and want to see what the client has in the IFrame (nope, not possible, but it might still be what you are looking for so I included it)? Are you accessing a web server from C# and want to extract the HTML from the web server response? I am sure there are more possibilities, but this is what I could come up with as I typed, so you probably need to add some details on what you are doing and what you try to achieve.