展会信息港展会大全

dotnet封装的kindeditor编辑器控件
来源:互联网   发布日期:2016-01-26 10:52:23   浏览:1923次  

导读:KindEditor很不错,没有ForNet的扩展,我是搞 net开发的,就用它简单封装了一个控件,拖过来即可使用,使用更加简单KindEditor很不错,刚接触不久,非常喜欢。KindEditor网站有ForPHP等扩展的,没有ForNet的。我是 ...

KindEditor很不错,没有ForNet的扩展,我是搞.net开发的,就用它简单封装了一个控件,拖过来即可使用,使用更加简单

KindEditor很不错,刚接触不久,非常喜欢。KindEditor网站有ForPHP等扩展的,没有ForNet的。

我是搞.net开发的,就用它简单封装了一个控件,拖过来即可使用,使用更加简单。源码提供给大家,有兴趣的朋友可以进一步完善。

1、第一次使用,需要配置一下web.config。

代码如下:

<configSections>

<section name="KindEditor" type="KindEditorForDotNet.ConfigHandler,KindEditorForDotNet"/>

</configSections>

<KindEditor>

<!--编辑的所在路径-->

<item key="BasePath" value="~/KindEditor"/>

<!--上传文件的路径-->

<item key="UploadPath" value="~/Upload"/>

<!--主题类型-->

<item key="Theme:simple" value="'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',

'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',

'insertunorderedlist', '|', 'emoticons', 'image', 'link'"/>

<item key="Theme:book" value="'forecolor', 'hilitecolor', 'bold', 'italic', 'underline','removeformat'"/>

</KindEditor>

2、然后引用DLL文件,包括KindEditorForDotNet、LitJSON.dll;

3、使有的时候,直接把控件拖到webform中即可,如果控件没有出现在控件栏目,直接引用也可以

代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EditorDemo._Default" %>

<%@ Register Assembly="KindEditorForDotNet" Namespace="KindEditorForDotNet" TagPrefix="cc1" %>

<!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>

说明:该控件继承自TextBox; 可以设置Width、Height、Enabled(是否只读)<hr />

默认风格<br />

<cc1:editor id="Editor1" runat="server" Height="100px" Width="100%"></cc1:editor><br />

自定义风格(风格来自于web.config中配置)<br />

<cc1:Editor ID="Editor2" runat="server" ThemeType="simple" Height="100px"></cc1:Editor></div>

显示字数 (已经输入:<span class="count"></span>)

<br />

<cc1:Editor ID="Editor3" runat="server" ThemeType="book" afterChange="function(){K('.count').html(this.count('text'))}" Height="60px" Width="300px"></cc1:Editor>

<hr />

</form>

</body>

</html>

赞助本站

人工智能实验室

相关热词: kindeditor dotnet

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港