Sitefinity CMS

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

Glossary Item Box

Polls can be deleted by passing the ID of the poll item to the DeletePoll method.

By deleting the poll, all questions and answers belonging to this poll will be deleted as well.

 Delete a poll by passing the ID of the poll to the DeletePoll method:

DeletePoll(Guid id) Copy Code
// create a new instance of ListManager
Telerik.Polls.PollManager pollManager = new Telerik.Polls.PollManager();
// get all polls
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;
    
// delete the first poll
    
pollManager.DeletePoll(firstPollId);
}

 

See Also