Sitefinity CMS

Modifying Forum Categories Send comments on this topic.
See Also
Developing with Sitefinity > Modules > Modules API > Forums > Forum Categories > Modifying Forum Categories

Glossary Item Box

Updating a Category is a very simple process:

  1. Get a Category associated with a transaction
  2. Change its properties
  3. Save the Category with ForumManager
SaveCategory(ICategory category) Copy Code
// create new instance of ForumManager
Telerik.Forums.ForumManager forumManager = new Telerik.Forums.ForumManager();
// get all cetgories
IList listOfAllCategories = forumManager.GetCategories();
if (listOfAllCategories.Count > 0)
{
   
// get first category
   
Telerik.Forums.ICategory firstCategory = forumManager.GetCategory(((Telerik.Forums.ICategory)listOfAllCategories[0]).ID);
   
// change title of the post
   
firstCategory.Name = "Changed Name of First Category";
   
// save the post
   
forumManager.SaveCategory(firstCategory);
   Response.Write(firstCategory.Name +
"<br />");
}

 

See Also