Sitefinity CMS

Modifying Lists Send comments on this topic.
See Also
Developing with Sitefinity > Modules > Modules API > Lists > Lists (NamedList) > Modifying Lists

Glossary Item Box

Updating lists is a very simple process:

  1. Find the list to be updated
  2. Change its properties (that is, change the name of the list)
  3. Save the list
SaveList(INamedList list) Copy Code
// create a new instace of ListManager
Telerik.Lists.ListManager listManager = new Telerik.Lists.ListManager();
// we are going to retrieve all lists and change the name of the first list
IList lists = listManager.GetLists();
if (lists.Count > 0)
{
   
// we get the ID of the first list
   
Guid firstListId = ((Telerik.Lists.INamedList)lists[0]).ID;
   
// when updating List, we need to retrieve it with GetList function, so that
   
// the object is associated with transaction
   
Telerik.Lists.INamedList firstList = listManager.GetList(firstListId);
   
// we change the Name property of the first list
   
firstList.Name = "First list - changed name";
   
// finally we save the first list and effectively update it
   
listManager.SaveList(firstList);
}


 

See Also