Sitefinity CMS

Modifying Polls Send comments on this topic.
See Also
Developing with Sitefinity > Modules > Modules API > Polls > Poll Items > Modifying Polls

Glossary Item Box

Updating polls is a very simple process:

  1. Find the poll to be updated
  2. Change its properties (that is, change the title of the poll)
  3. Save the poll

Save a specified poll item:

UpdatePoll(IPollItem UpdatedPoll) Copy Code
// create a new instace of PollManager
Telerik.Polls.PollManager pollManager = new Telerik.Polls.PollManager();
// retrieve all poll items
IList<Telerik.Polls.IPollItem> listOfAllPolls = pollManager.GetAllPolls();
if (listOfAllPolls.Count > 0)
{
   
// we get the ID of the first poll
   
Guid firstPollId = ((Telerik.Polls.IPollItem)listOfAllPolls[0]).ID;
   
// when updating Poll, we need to retrieve it with GetPollById function, so that
   
// the object is associated with transaction
   
Telerik.Polls.IPollItem firstPoll = pollManager.GetPollById(firstPollId);
   
// we change the Title property of the first poll
   
firstPoll.Title = "First poll - changed title!";
   
// finally we update the first poll
   
pollManager.UpdatePoll(firstPoll);
}


See Also