之前试过几次,每次用的时候都有点小问题,这次完全搞定哈。
前期准备:需要WebEditor第三方编辑器(自己去下),放在网站根目录下。
测试页面:Temp.aspx Temp.aspx.cs
效果:点击按钮将编辑器中文字代码打印出来。
Temp.aspx内容:
![]()
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Temp.aspx.cs" Inherits="Temp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="content1" name='content1' cols="20" rows="2" style="display:none" runat="server" ></textarea>
<IFRAME ID='eWebEditor1' src='WebEditor/ewebeditor.asp?id=content1&style=s_coolblue' frameborder='0' scrolling='no' width='550' height='300'></IFRAME>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div>
</form>
</body>
</html>
Temp.aspx.cs内容
![]()
Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Temp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
content1.Value="dddddd";
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = content1.Value;
}
}
可以了,很弱智的。