The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
Sitefinity in its current version comes with two built-in settings: TextSetting and ContentSetting. In the previous post I’ve explained the TextSetting control and in this one we will explore ContentSetting.
Before I dig into the details, the first question that ought to be answered is why use different settings. The answer is quite simple: they control their targets in different manner. TextSetting is the most rudimentary setting which controls the visibility, label and format of its target control. ContentSetting is a bit more advanced setting, which generally (though its not a rule) controls a target which displays a full content of generic content item (news, post, event…).
Adding a ContentSetting to the designer is no different than adding the TextSetting. You simply have to open the designer template and declare the control inside of the Master od Detail settings collection of the given presentation mode. If you wish to see an example of this, you can open the following file in your Sitefinity installation:
~/Sitefinity/Admin/ControlTemplates/Blogs/Design/BlogPostsControlDesigner.ascx
and scroll down to the MasterSettings collection od the ModeSettings1 control. You will find ContentSetting control there declared as follows:
<sfDesignSettings:ContentSetting id="ContentSetting1" |
TargetID="content"> |
</sfDesignSettings:ContentSetting> |
As you can see ContentSetting control needs only two properties to be set:
In the previous post, we’ve seen that the appearance of the TextSetting control largely depends on the value of its properties. ContentSetting control, on the other hand, always looks the same. Take a look at Figure 1 to see how can you recognize a ContentSetting control in your designer.
Figure 1: Two modes of ContentSetting control
Admittedly, this section should have been closer to the beginning of the post, but better late than never. ContentSetting control has a purpose of dynamic creation of summaries. Let’s imagine that we want to display a list of blog posts. By implementing a ContentSetting control on the “content” or “post” target control, which is bound to the full text of the post, we can easily open the designer and switch to the summary mode where we can define how do we want the summary to be created. We can limit the number of words that we want to display, as well as perform html stripping. In case we want to display the full post with all HTML, we can just switch back to the content mode.
Now that we have covered the two built in settings, in the next post, we’ll do something more exciting. We are going to create our own custom setting control. Then in the posts to follow, we’ll explore presentation modes and how to extend those and for the grand finale - we are going to build a whole custom content view designer.
If you have any questions or suggestions, please leave a comment.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.