Umbraco-color picker-demo

Source: Internet
Author: User
Tags umbraco
ArticleDirectory
    • 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
    • 4. Add the color to generic properties in the textpage document type.
    • 5. Set the color in the content Properties tab
    • 6. Apply the color in the template
    • 7. See the effect.
Demo

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

Steps1. 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 ype 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.