博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Umbraco-Color Picker–Demo
阅读量:7213 次
发布时间:2019-06-29

本文共 1588 字,大约阅读时间需要 5 分钟。

Demo

Allow the end user has ability to change the background color with pre-defined color.

Steps

1. Create a datatype named BackGroundColor.

 

2. Select Color Picker as its render control and select Nvarchar as its Database datatype.

 

3. Add the pre-defined colors

You can add any number of colors as you wish.

 

4. Add the color to Generic Properties in the TextPage document type.

It is reasonable to place Content  BackGround Color in the Generic properties tab as it controls the content’s background color.

 

5. Set the color in the content properties tab

After 1 – 4 steps are carried out, the Content BackGround Color comes up to you when you select the properties tab in content page which take TextPage as its template. Select one of color as your background color here.

 

6. Apply the color in the template

The code finally looks like the following.

<div class="entry" style="background-color:#<umbraco:Item field="contentBackGroundColor" runat="server" />">

                    <umbraco:item runat="server" field="bodyText"></umbraco:item>
                </div>

 

7. See the effect.

 

More knowledge

Umbraco datatypes are created based on the control either shipped with umbraco or self-developed implementing IDataType interface. You can create you specific datatype with specific pre-defined values in different context in your umbraco site. For example, you can create background color 1 and background color 2 based on color picker to control colors in different areas in the template. Have fun here.

 

The source code is available at in CodePlex.

Supported by

转载于:https://www.cnblogs.com/czy/archive/2012/03/29/2424421.html

你可能感兴趣的文章
C#设计模式(14)——模板方法模式(Template Method)
查看>>
构建高性能的ASP.NET应用(五)-如何开始寻找性能瓶颈
查看>>
ipython notebook [jupyter] 使用
查看>>
[原创]Editplus巧删文本中大量空行
查看>>
SharePoint常见问题一:无法连接数据库
查看>>
LAMP自动安装脚本(上)
查看>>
安全规范和指南系列之二
查看>>
IT草根的江湖之路之七: 挑战,刚刚开始
查看>>
总结之:CentOS6.5 DNS服务BIND配置、正反向解析、主从及压力测试(1)
查看>>
Spring Security(16)——基于表达式的权限控制
查看>>
Oracle中的LOB数据类型以及ibatis中处理该类型的typeHandler
查看>>
917:Knight Moves
查看>>
【IT基础】windows核心编程整理(上)
查看>>
[arm驱动]linux并发与竞态---并发控制
查看>>
jailkit 限制用户活动范围和权限
查看>>
WMI技术的使用
查看>>
Socket编程实践(10) --select的限制与poll的使用
查看>>
析构函数(C# 编程指南)
查看>>
Unix Study之--AIX安装和配置SSH
查看>>
Silverlight粉丝们 让微软听到我们的声音
查看>>