• UmbracoColor Picker–Demo CQ


    Demo

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

    Steps

    1. Create a datatype named BackGroundColor.

    image

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

    image

    3. Add the pre-defined colors

    image

    You can add any number of colors as you wish.

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

    image

    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

    image

    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

    image

    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.

    image

    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 NovaUmbracoDemo in CodePlex.

    Supported by Nova Umbraco

  • 相关阅读:
    PeCheck
    模拟木马
    青柠网络验证
    青柠网络验证一键合成工具(exe程序和网络验证合成)
    如果想看我以前发的文章,请到下面地址查看
    星空QQ音乐下载2.0 (可下载收费音乐)
    vmp分析文章
    星空QQ群1.0模块
    青柠网络验证
    Java之IO操作总结
  • 原文地址:https://www.cnblogs.com/czy/p/2424421.html
Copyright © 2020-2023  润新知