Updating polls is a very simple process:
- Find the poll to be updated
- Change its properties (that is, change the title of the poll)
- 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