Group polls web part

   —   
This article describes how to display group polls using the Poll web part, instead of site polls only.
First, it is recommended to clone your current web part and perform modifications on its clone. Please find the link dealing with how a web part can be cloned below (in “See also” section).

Then, you need to copy and modify the appropriate selector, which is located in <project folder>/CMSModules/Polls/FormControls/pollselector.ascx file.

In code-behind, the following code can be found:

DataSet ds = PollInfoProvider.GetPolls();

It returns the Dataset structure of all polls of the specified site.

If you want it to select group polls, you need change it like this:

DataSet ds = CMS.Polls.PollInfoProvider.GetGroupPolls(int32, int32);

The parameters mean the following:

int siteId,
int groupId

SiteID you can get from CMS.CMSHelper.CMSContext.CurrentSiteID and
grouipId you can get from CMS.PortalEngine.PageInfo.NodeGroupId.

Please know that there is already “Group polls web part,” but its purpose is different. This web part provides the possibility of managing the group polls (edit / delete), whilst customization described in this article provides the possibility of showing group polls in standard “Polls web part.”
-rm-


See also:

Applies to: Kentico CMS 5.5
Share this article on   LinkedIn