Get HTML source code for editable iframe on server side

Source: Internet
Author: User
Tags end
Server | Source code The following example implements the HTML source code for an editable iframe on the server side. The code is simple, the pain here is not much explained. The code is as follows:

Getiframehtml.axpx

<%@ Page language= "<a href=" http://dev.21tx.com/language/vb/"target=" _blank ">VB</a>" Validaterequest=false autoeventwireup= "false"
codebehind= "Getiframehtml.<a href=" http://dev.21tx.com/web/asp/"target=" _blank ">asp</a>x.vb" inherits= "Aspx<a href=" http://dev.21tx.com/web/target= "_blank" &GT;WEB&LT;/A&GT;. Getiframehtml "%>
<HTML>
<body>
<form id= "Frmmain" method= "POST" runat= "Server" >
<iframe id= "ifrhtml" name= "ifrhtml" ></iframe>
<br>
<asp:button id= "Cmdsend" runat= "Server" text= "Submit" ></asp:Button>
<input type= "hidden" name= "Hidvalue" >
</form>
<script>
IfrHTML.document.designMode = "on";
</script>
</body>
</HTML>


GetIframeHtml.aspx.vb

Public Class getiframehtml
Inherits System.Web.UI.Page
Protected WithEvents Cmdsend as System.Web.UI.WebControls.Button
Protected WithEvents ifrhtml as System.Web.UI.HtmlControls.HtmlGenericControl

#Region "Web Form Designer generated Code"

' This are required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough () > Private Sub InitializeComponent ()

End Sub

Private Sub Page_Init (ByVal sender as System.object,_
ByVal e as System.EventArgs) Handles Mybase.init
' Codegen:this Method-required by the Web Form Designer
' Do not modify it using the ' Code Editor.
InitializeComponent ()
End Sub

#End Region

Private Sub Page_Load (ByVal sender as System.object,_
ByVal e as System.EventArgs) Handles MyBase.Load
CMDSEND.ATTRIBUTES.ADD ("OnClick", "Document.frmMain.hidValue.value" + _
"= IfrHTML.document.body.innerHTML;")
End Sub


Private Sub cmdSubmit_Click (ByVal sender as System.object,_
ByVal e as System.EventArgs) Handles Cmdsend.click
Dim strvalue as String
strvalue = Request.Form ("Hidvalue")
Response.Write (Server.htmldecode (strvalue))
End Sub

End Class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.