Deliver superior customer experiences with an AI-driven platform for creating and deploying cognitive chatbots
Deliver Awesome UI with the most complete toolboxes for .NET, Web and Mobile development
Automate UI, load and performance testing for web, desktop and mobile
A complete cloud platform for an app or your entire digital business
Detect and predict anomalies by automating machine learning to achieve higher asset uptime and maximized yield
Automate decision processes with a no-code business rules engine
Optimize data integration with high-performance connectivity
Connect to any cloud or on-premises data source using a standard interface
Build engaging multi-channel web and digital experiences with intuitive web content management
Personalize and optimize the customer experience across digital touchpoints
Build, protect and deploy apps across any platform and mobile device
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.
Ok, after short break with SiteActivity control, back to the serious stuff. Continuing the “In the mean time series”, we are making headway to the full-fledged products module. In this post I will demonstrate how to enable comments on our products module – module based on Generic Content.
NOTE: This sample has been created and built with Sitefinity 3.5 Service Pack 1, however it will work normally with 3.5 as well. For users running Sitefinity 3.2 the sample should work as well, though you will need to change the references and implementation of RadControls. You can take a look at the first two samples in the developers manual two see how the implementation was done for 3.2.
NOTE: In case you don’t think you need the instructions, you can download the sample code for this project from here and skip the reading.
The process of enabling comments is not much different than the one for enabling categories or tags. Again, we will divide our task in two parts:
Before we proceed, make sure you have at least set up the products module project like it was described in the introductiory article of this series.
On the admin side, we have to enable the CommentsView command and provide the templates for the Comments functionality. Once we are done we will be able to access the CommentsView of Products module which will look like the one at the Figure 1:
Figure 1: CommentsView command on the left and CommentsView control on the right
We are done with the CommandPanel class and you can save and close that file. The last thing on the admin side is to provide our products module with the admin side templates for comments related controls. Like so many times in this series, we’ll turn to the Generic_Content module and copy the templates located there. Copy following files: ~/Sitefinity/Admin/ControlTemplates/Generic_Content/CommentsEdit.ascx ~/Sitefinity/Admin/ControlTemplates/Generic_Content/CommentsList.ascx ~/Sitefinity/Admin/ControlTemplates/Generic_Content/CommentsView.ascx ~/Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources/CommentsEdit.ascx.resx ~/Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources/CommentsList.ascx.resx ~/Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources/CommentsView.ascx
to following folders respectively: ~/Sitefinity/Admin/ControlTemplates/Products ~/Sitefinity/Admin/ControlTemplates/Products ~/Sitefinity/Admin/ControlTemplates/Products ~/Sitefinity/Admin/ControlTemplates/Products/App_LocalResources ~/Sitefinity/Admin/ControlTemplates/Products/App_LocalResources ~/Sitefinity/Admin/ControlTemplates/Products/App_LocalResources
And we’re done with the admin side! Though it takes some “paper” to explain it, actually the process itself takes no more than 5 minutes.
So, we’ve got everything working on the back side, now all we are left with is to add the UI for the visitors to leave and read the comments. Once again, there is a handy control which we are going to steal from the Generic Content module – the name of the control is CommentsList. Let’s start by copying the template for this control from the public templates of the Generic_Content modules to the public templates of our Products module. Copy following files: ~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx ~/Sitefinity/ControlTemplates/Generic_Content/App_LocalResources/CommentsList.ascx.resx
to following folders respectively: ~/Sitefinity/ControlTemplates/Products/ ~/Sitefinity/ControlTemplates/Products/App_LocalResources
Now that templates are ready, open following file used to display single product: ~/Sitefinity/ControlTemplates/Products/ContentViewSingleItem.ascx
and add the CommentsList control somewhere in it, by pasting the following lines:
As you can see we have hardcoded the TemplateUrl, but we could also declare it inline, like it is done in Generic_Content or Blog folders (take a look at the detail templates of these modules).
Figure 2: ProductsView control with the CommentsList control – comments enabled on the public side of the module
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.
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.