Sitefinity CMS
Search Sitefinity 3.x and older versions
Contents
Introduction
What is New in This Sitefinity Version
Readers Guidelines
Installation
Core Concepts
Sitefinity in Visual Studio
Sitefinity Building Parts
Developing with Sitefinity
Data Access
Pages
Controls
Modules
Adding New Modules to Sitefinity
Modules API
Modules API Overview
Generic Content
Overview of Generic Content API
Important Interfaces of Generic Content Module
Content Items
Comments
Comments Overview
Creating Comments
Finding Comments
Modifying Comments
Deleting Comments
Managing Read Status of Comments
Categories
Tags
Generic Content Based Modules
Lists
Polls
Forums
Newsletters
Services
Programming Security
Personalization Framework
Designing with Sitefinity
Security
How-to
API Reference
PID463; RID7; VID0; IsStatic1
Modifying Comments
Send comments
on this topic.
See Also
Developing with Sitefinity > Modules > Modules API > Generic Content > Comments > Modifying Comments
Glossary Item Box
Updating a Comment is a very simple process:
Get a Comment associated with a transaction
Change its properties
Save the Comment with ContentManager
SaveComment(IComment comment)
Copy Code
// create new instance of ContentManager
Telerik.Cms.Engine.ContentManager contentManager =
new
Telerik.Cms.Engine.ContentManager();
// get all content items
IList listOfContentItems = contentManager.GetContent();
if
(listOfContentItems.Count > 0)
{
// get the third content item
Telerik.Cms.Engine.IContent thirdContent = contentManager.GetContent(((Telerik.Cms.Engine.IContent)listOfContentItems[2]).ID);
// get all comments for the content item thirdContent
IList listOfComments = contentManager.GetComments(thirdContent.ID);
// get the first comment
Telerik.Cms.Engine.IComment firstComment = contentManager.GetComment(((Telerik.Cms.Engine.IComment)listOfComments[0]).ID);
// change the value of the Text property
firstComment.Text =
"Changed text of comment of item 3"
;
// save the change in the database
contentManager.SaveComment(firstComment);
Response.Write(firstComment.Text +
"<br />"
);
Response.Write(firstComment.Parent.GetMetaData(
"Name"
) +
"<br />"
);
}
See Also
Overview of Generic Content API
Important Interfaces of Generic Content Module
Content Items Overview
Creating Content Items
Finding Content Items
Modifying Content Items
Deleting Content Items
Comments Overview
Creating Comments
Finding Comments
Deleting Comments
Managing Read Status of Comments
Categories Overview
Creating Categories
Finding Categories
Modifying Categories
Deleting Categories
Tags Overview
Creating Tags
Finding Tags
Modifying Tags
Deleting Tags
not -included