求帮看下CKEditor显示内容时的问题
代码是 用 ajax请求 handler ,handler从数据库中取出数据,处理后返回给html页面
handler处理的时候有问题,
public void ProcessRequest(HttpContext context)
{
try
{
context.Response.ContentType = "text/plain";
string id = context.Request["id"].ToString();
ArticleDAO dao = new ArticleDAO(connString);
Article article = dao.GetArticle("id=" + id);
System.Collections.Generic.List<ArticleImage> list = new List<ArticleImage>();
string strWhere = "ArticleId =" + article.Id;
SqlClientHelper sch = new SqlClientHelper(connString);
StringBuilder sb = new StringBuilder();
sb.Append("select * from [ArticleImage]");
sb.Append(" where " + strWhere);
//就在这里出问题,注释掉这一句 就正常了,加上这一句就无法显示出内容
//在ajax回调里都可以取到数据,但就是不能显示在CKEditor里,也可以在页面的其他div里显示,唯独在CKEditor里显示不出来
// 这是从数据库取数据的,相关代码贴下面
DataTable dt = sch.GetData(sb.ToString());
IsoDateTimeConverter iso = new IsoDateTimeConverter();
iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
String str = JsonConvert.SerializeObject(article, iso);
context.Response.Write(str);
}
}/// <summary>
/// 获取查询结果集
/// </summary>
/// <param name="queryString">查询语句</param>
/// <returns>DataTable结果集</returns>
public DataTable GetData(string commandText)
{
DataTable dt = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter(commandText, conn);
try
{
conn.Open();
adapter.Fill(dt);
}
catch (Exception ex)
{
throw ex;
}
finally
{
adapter.Dispose();
conn.Close();
}
return dt;
}public class ArticleImage
{
//编号
private System.Int32 _id;
public System.Int32 Id
{
get { return _id; }
set { _id = value; }
}
//文章编号
private System.Int32 _articleid;
public System.Int32 ArticleId
{
get { return _articleid; }
set { _articleid = value; }
}
//图片数据
private System.Byte[] _data;
public System.Byte[] Data
{
get { return _data; }
set { _data = value; }
}
//创建时间
private System.DateTime _createdate;
public System.DateTime CreateDate
{
get { return _createdate; }
set { _createdate = value; }
}
//文件路径
private System.String _filepath;
public System.String FilePath
{
get { return _filepath; }
set { _filepath = value; }
}
//文件名
private System.String _filename;
public System.String FileName
{
get { return _filename; }
set { _filename = value; }
}
//图片类型
private System.String _imagetype;
public System.String ImageType
{
get { return _imagetype; }
set { _imagetype = value; }
}
//宽度
private System.Int32 _width;
public System.Int32 Width
{
get { return _width; }
set { _width = value; }
}
//高度
private System.Int32 _height;
public System.Int32 Height
{
get { return _height; }
set { _height = value; }
}
//点击量
private System.Int32 _clickcount;
public System.Int32 ClickCount
{
get { return _clickcount; }
set { _clickcount = value; }
}
//HTTP地址
private System.String _httpaddress;
public System.String HttpAddress
{
get { return _httpaddress; }
set { _httpaddress = value; }
}相关推荐
CKEDITOR实现新闻内容富文本显示以及添加修改
CKEDITOR实现新闻内容富文本显示以及添加修改,文档为前台实现ckeditor的代码。
当使用ckeditor控件时,需要校验输入内容是否为空的一种解决办法(转帖)
样是我们写程序中最经常的写法 提交之前进行验证内容是否为空!
ckeditor-autocomplete-suggestions-plugin:键入时可显示建议的Ckeditor插件
ckeditor自动完成插件 在键入时显示建议的Ckeditor插件,该建议由您定义,触发插件的操作键也由开发人员定义。 为了创建一个建议框,您将必须使自定义插件使用上下文菜单作为建议框,请从此处查看链接以获取制作ckeditor插件的基本知识。 将此添加到您的config.js中,其中autocomplete是插件的名称 config.extraPlugins ='自动完成'; 然后在ckeditor文件夹中创建以下目录结构/文件 ckeditor-> plugins-> autocomplete-> plugin.js将以下内容放入您的plugin.js文件中 CKEDITOR.plugins.add('autocomplete',{init:function(editor){ var autocompleteCommand = editor.a
flask-ckeditor:Flask的CKEditor集成,包括图像上传,代码语法突出显示等
Flask-CKEditor Flask的CKEditor集成,包括图像上传,代码语法突出显示等。 链接 执照 该项目已获得MIT许可证的许可(有关详细信息,请参阅LICENSE文件)。
ckeditor和ueditor那个好 CKEditor和UEditor使用比较
本来项目中使用CKEditor已经做好了的富文本编辑器的功能,但是业务考虑到美观性要求换成UEditor,所以就在这里总结下,需要的朋友可以参考下


