C#如何把Editor设计的内容上传到服务器端
来源:互联网 发布:如何破解网络尖兵 编辑:程序博客网 时间:2024/05/30 22:59
如何把Editor设计的内容上传到服务器端
实现这样的功能就可以把设计的HTML格式的(含标记)的文本保存到服务器端数据库中二进制字段中,实现内容的动态保存和加载。
设计步骤:
1.添加内容到Editor(包括:字体、图片 等.......)
2.按【HTML】按钮
3.按【读取】按钮,把Editor设计的标记字符串填入服务器控件Text
注意:包含HTML标记的字符串被认定为不安全的。
4.若要直接读取请在【读取】Button2按钮,中属性OnClientClick="show('html') 执行与按钮【HTML】相同的js函数
(由于博客图片审核功能尚未完成,普通用户暂时关闭引用站外图片功能,请您谅解)
图片请到这里查看:http://user.qzone.qq.com/14035344/blog/1310785498
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 _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { Label1.Text = content.InnerText .ToString (); TextBox1.Text = content.InnerText.ToString(); }}
html:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@ Register Src="UserControl/HtmlEdit.ascx" TagName="HtmlEdit" TagPrefix="uc1" %><!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> <table border="1" cellpadding="0" cellspacing="0" style="width: 500px"> <tr> <td> <div id="html" style="display: none"> <textarea id="content" runat="server" name="content" rows="10" style="width: 500px; height: 280px"></textarea></div> <div id="edit"> <uc1:HtmlEdit ID="HtmlEdit1" runat="server" /> </div> </td> </tr> <tr> <td> <input onclick="show('edit')" style="width: 80px" type="button" value="设计" /><input id="Button1" onclick="show('html')" style="width: 80px" type="button" value="HTML" /> <input onclick="alert(oEditor.document.body.innerHTML);" type="button" value="getContent" /></td> </tr> </table> <table style="width: 510px"> <tr> <td style="height: 44px"> 如何把Editor设计的内容上传到服务器端<br /> 实现这样的功能就可以把设计的HTML格式的(含标记)的文本保存到服务器端数据库中二进制字段中,实现内容的动态保存和加载。<br /> 设计步骤:<br /> 1.添加内容到Editor(包括:字体、图片 等.......)<br /> 2.按【HTML】按钮<br /> 3.按【读取】按钮,把Editor设计的标记字符串填入服务器控件Text<br /> 注意:包含HTML标记的字符串被认定为不安全的。<br /> <br /> 4.若要直接读取请在【读取】Button2按钮,中属性OnClientClick="show('html') 执行与按钮【HTML】相同的js函数 </td> <td style="height: 44px; width: 3px;"> </td> <td style="height: 44px; width: 2px;"> </td> </tr> <tr> <td> <asp:Button ID="Button2" runat="server" Text="读取" OnClick="Button2_Click" OnClientClick="show('html')" /></td> <td style="width: 3px"> </td> <td style="width: 2px"> </td> </tr> <tr> <td style="height: 60px"> <asp:TextBox ID="TextBox1" runat="server" Height="49px" TextMode="MultiLine" Width="482px"></asp:TextBox></td> <td style="height: 60px; width: 3px;"> </td> <td style="height: 60px; width: 2px;"> </td> </tr> <tr> <td style="height: 32px"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></td> <td style="width: 3px; height: 32px"> </td> <td style="width: 2px; height: 32px"> </td> </tr> </table> </div> </form></body></html>
作者:段利庆 QQ;14035344
- C#如何把Editor设计的内容上传到服务器端
- Delphi 把客户端的文件或者目录上传到服务器端
- c#客户端图片上传到服务器端文件并且把路径保存到SQL数据库
- 关于如何把canvas中的内容转换为图片上传到服务器的操作过程
- 怎么把上传的excel表内容导入到数据库
- c#如何实现excel的表间传值(把一excel表内容复制到另一excel表)?
- 如何把数据库的内容写入到Word文档中
- 如何把数据库的内容写入到Word文档中?
- 如何把vim的内容粘贴到vim外部
- 如何把自己的项目上传到GitHub上
- 如何通过Web方式把服务器端的数据库备份到本地的电脑硬盘中?
- 如何通过Web方式把服务器端的数据库备份到本地的电脑硬盘中?
- 如何通过Web方式把服务器端的数据库备份到本地的电脑硬盘中?
- 如何将本地表的内容上传到服务器上去?
- 如何把DataGrid内容导出到Excel
- 如何把本地项目上传到github
- 如何把代码上传到github
- 如何把本地项目上传到Github
- MongoDB 提供了多样性的索引支持。
- 分治法 求最大元和最小元 Java语言
- 改变MTU
- POJ 2665 Trees
- No 3 · 使用Request对象的Browser属性获取客户端浏览器信息
- C#如何把Editor设计的内容上传到服务器端
- 如何把matlab命令窗口中的信息输出(重定向)到文件?
- 面向对象编程(C++描述)总结
- C语言回调函数与函数指针
- 何为NDK ?
- No 4 · 获取客户端和服务器端IP地址
- android:View cannot be resolved to a type
- CSS Positioning
- Qt(学习)windows下Qt&MySQL数据库配置过程