程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> ASP.NET基礎 >> dotnet封裝的kindeditor編輯器控件

dotnet封裝的kindeditor編輯器控件

編輯:ASP.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>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved