Creating custom datatypes using the umbraco usercontrol wrapper
本篇文章介绍的是基于UmbracoCMS技术搭建的网站所使用的相关技术。
1. 需求
Umbraco CMS的dataType中有richTexhEditor控件,但是它不是太完善,比如没有对字体进行大小颜色等设置,所以需要对此控件进行替换,用一个功能更加完善一些的控件,从网上找到了一个第三方控件叫fckEditor,就是文本编辑器。
2. 添加步骤
1. 首先创建一个usercontrol,代码如下:
RichTextEditorControl.ascx
<%@ ControlLanguage="C#" AutoEventWireup="true"CodeFile="RichTextEditorControl.ascx.cs"
Inherits="UserControls_RichTextEditorControl" %>
<%@ RegisterAssembly="CKEditor.NET" Namespace="CKEditor.NET"TagPrefix="CKEditor" %>
<CKEditor:CKEditorControlID="CKEditor1" BasePath="~/ckeditor"runat="server" Height="450"
Width="590"></CKEditor:CKEditorControl>
RichTextEditorControl.ascx.cs
using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
usingSystem.Web.UI.WebControls;
public partial classUserControls_RichTextEditorControl :System.Web.UI.UserControl,umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
{
public string m_UmbracoValue;
protected void Page_Load(object sender,EventArgs e)
{
if (Page.IsPostBack)
{
m_UmbracoValue = CKEditor1.Text;
}
CKEditor1.Text = m_UmbracoValue;
//设置fckEditor的工具栏选项
CKEditor1.config.toolbar = new object[]
{
new object[] {"Source", "-", "NewPage", "Preview","-", "Templates" },
new object[] {"Cut", "Copy", "Paste", "PasteText","PasteFromWord"},
new object[] {"Undo", "Redo", "-", "Find", "Replace","-", "SelectAll", "RemoveFormat" },
"/",
new object[] {"NumberedList", "BulletedList", "-","Outdent", "Indent", "Blockquote"},
new object[] {"JustifyLeft", "JustifyCenter", "JustifyRight","JustifyBlock" },
new object[] {"Link", "Unlink", "Anchor" },
new object[] {"Image", "Table", "HorizontalRule","SpecialChar", "PageBreak", "Iframe" },
"/",
new object[] {"Bold", "Italic", "Underline"},
new object[] {"Styles", "Format", "Font", "FontSize"},
new object[] {"TextColor", "BGColor" }
};
}
public object value
{
get
{
returnm_UmbracoValue;
}
set
{
m_UmbracoValue = value.ToString();
}
}
}
2. Xslt代码:
登录Umbraco后台选择Develeoper页签,创建一个DataType。
然后在renderControl中选择umbraco usercontrol wrapper并保存。
然后可以看到usercontrol的选择框,即选择我们创建的usercontrol即可。
到此为止我们就创建成功一个datatype,在Settings也页签中的Document type中就可以选择该DataType了。
Creating custom datatypes using the umbraco usercontrol wrapper的更多相关文章
- 【IOS笔记】Creating Custom Content View Controllers
Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of ...
- ASP.NET MVC- VIEW Creating Custom HTML Helpers Part 2
The goal of this tutorial is to demonstrate how you can create custom HTML Helpers that you can ...
- Extending JMeter – Creating Custom Config Element – Property File Reader
JMeter is one of the best open source tools in the Test Automation Community. It comes with all the ...
- Collection View Programming Guide for iOS---(六)---Creating Custom Layouts
Creating Custom Layouts 创建自定义布局 Before you start building custom layouts, consider whether doing so ...
- View Controller Programming Guide for iOS---(四)---Creating Custom Content View Controllers
Creating Custom Content View Controllers 创建自定义内容视图控制器 Custom content view controllers are the heart ...
- 管理后台-第一部分:Creating custom sections in Umbraco 7 - Part 1(翻译文档)
在Umbraco上每个部分都可以被称为一个应用程序,所以这些部分和应用程序基本上是一样的.我们首先要做的事情是需要创建应用程序.在这个例子中,我不会去摆弄xml文件或是数据库——我将使用类来创建我的内 ...
- [TensorFlow] Creating Custom Estimators in TensorFlow
Welcome to Part 3 of a blog series that introduces TensorFlow Datasets and Estimators. Part 1 focuse ...
- Creating Custom Connector Sending Claims with SharePoint 2013
from:http://blogs.msdn.com/b/security_trimming_in_sharepoint_2013/archive/2012/10/29/creating-custom ...
- Creating Custom Login Screen In Oracle Forms 10g
Below is the example plsql unit to validate login credentials and after successful validation open a ...
随机推荐
- PowerDesigner 如何添加每个表中共用的字段及自动添加注释
PowerDesigner 如何添加每个表中共用的字段: 有时候在创建表的时候会有一些共用的字段,但是每一张表都要去创建,这样做很麻烦,特别是这样重复的工作,稍不留意就会出现问题,实际上在PD中有这样 ...
- 黑马程序员-------.net基础知识五
方法(函数) 作用:用来重复代码,当我们在一个过程中反复的写了同样的代码,一般情况下,我们就可以把需要重复写的代码定义在方法中,用的时候只需调用即可 语法: [访问修饰符][static] 返回值类型 ...
- smarty 比较运算符对照表
smarty 比较运算符对照表 运算符 中文解释 eq 相等 ne.neq 不相等 gt 大于 lt 小于 gte.ge 大于等于 lte.le 小于等于 not 非 mod 求模 is [not] ...
- bzoj 3052: [wc2013]糖果公园 带修改莫队
3052: [wc2013]糖果公园 Time Limit: 250 Sec Memory Limit: 512 MBSubmit: 506 Solved: 189[Submit][Status] ...
- [BZOJ 2048] [2009国家集训队]书堆 【调和级数】
题目链接:BZOJ - 2048 题目分析 只有一本书时,这本书的重心落在桌子边缘上,伸出桌面的长度就是 1/2. 有两本书时,第一本书的重心就落在第二本书的边缘上,两本书的重心落在桌子边缘上,两本书 ...
- sharepoint 2013创建外部内容类型并创建外部列表
步骤: 1.如何:基于 SQL Server 表创建外部内容类型 How to: Create an External Content Type Based on a SQL Server Table ...
- 查看Mac OSX机器上存在的所有Device
可以使用instruments -s来查看Mac OSX机器上存在的所有Device,包括模拟器创建的Device以及真实连接的iPad,iPhone等设备.
- windows进程中的内存结构(好多API,而且VC最聪明)
在阅读本文之前,如果你连堆栈是什么多不知道的话,请先阅读文章后面的基础知识. 接触过编程的人都知道,高级语言都能通过变量名来访问内存中的数据.那么这些变量在内存中是如何存放的呢?程序又是如何使用这 ...
- 生意经:研究一下国外SAAS的产品线,比如Salesforce、Netsuite和Zendesk等等(Salesforce斥资7.5亿美元收购云计算字处理应用Quip)
看他们做什么,我就做什么-甚至比他们做的更好. ------------------------------------------------------------ 新浪科技讯 北京时间8月3日下 ...
- android-86-Can't create handler inside thread that has not called Looper.prepare()
以下是Android API中的一个典型的Looper thread实现: //Handler不带参数的默认构造函数:new Handler(),实际上是通过Looper.myLooper()来获取当 ...