+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Hiding poll results

Hiding poll results

16 posts, 0 answered
  1. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    25 Jan 2008
    Link to this post
    How do you hide the poll results from voters?  After a person votes, I want to show them a thank you message instead of the poll results so I can keep the poll results private.
  2. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    28 Jan 2008
    Link to this post
    Hello Nancy,

    There is a known issue with the current official release of Sitefinity which prevents the private results function. Anyway, this functionality will be fixed for the next release. If you need it urgently, we could send you a custom poll box control with this bug fixed.

    Sincerely yours,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    28 Jan 2008
    Link to this post
    Please do send me the custom control with the bug fix. Thanks for your help. -Nancy
  4. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    31 Jan 2008
    Link to this post
    Hi Nancy,

    We answered to the support ticket you submitted. Please excuse us  for the delay.

    Greetings,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    06 Feb 2008
    Link to this post
    I have implemented the new pollbox that you sent.  I dragged the PollBox2 control onto my page, selected the PollId and then set the "ShowResultsLink" to false.  When I publish the page and vote, I am still seeing poll results.  Do I need to change any other settings?  Thanks, Nancy
  6. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    07 Feb 2008
    Link to this post
    Hello Nancy,

    Actually, the property is called ShowResults. The other properties are not necessary in order to enable this feature. Please, let me know for the result or if I am missing something. I want to mention once again that the feature has not been tested yet and there might be problems.


    All the best,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    07 Feb 2008
    Link to this post
    I don't see a setting for ShowResults in the PollBox2 control interface. Where exactly does the person creating the page and adding the pollbox find this setting? What tab is it under? I found the ShowResultsLink under the "Appearance" tab, but I don't see ShowResults. Thanks for your help. -Nancy 
  8. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    07 Feb 2008
    Link to this post
    I just looked at the .cs file for PollBox2 and I don't see a ShowReuslts property in the code either.  Is it possible that I don't have the latest version of PollBox2?
  9. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    07 Feb 2008
    Link to this post
    Well, I just answered my own question.  I went back to the original PollBox2.cs file and recompiled. Now, I do see the setting and when I set ShowResults to false, the user sees a thank you message right after they vote which is good.  The bad part is that if they navigate away from the page and then come back later, they see the results. It seems to only show the message right after the vote, but not on subsequent visits to the page. Any ideas how to fix this?  Thanks again for your help. Nancy
  10. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    08 Feb 2008
    Link to this post
    Hi Nancy,

    This should happen if the IPBlocking property of the control is set to true. Thus you can vote only once for a poll. So when you come back to the page with the poll and you have already voted, it is supposed to show the results. 
    With this new implementation you shouldn't see the results, so I guess adding some text message would make sense. You could implement it by modifying the CreateChildControls method from this one:

    protected override void CreateChildControls()  
    {  
        this.cnt = new PollBoxContainer(this);  
        if (this.itemTemplate == null)  
        {  
            string str = string.IsNullOrEmpty(this.TemplatePath) ? string.Empty : this.TemplatePath;  
            if (this.Page != null)  
            {  
                if (!(string.IsNullOrEmpty(str) || !File.Exists(this.Page.MapPath(str))))  
                {  
                    thisthis.itemTemplate = this.Page.LoadTemplate(str);  
                }  
                else  
                {  
                    this.itemTemplate = new DefaultTemplate(this);  
                }  
            }  
            else if (base.DesignMode)  
            {  
                Page page = new Page();  
                if (!(string.IsNullOrEmpty(str) || !File.Exists(HttpContext.Current.Request.MapPath(str))))  
                {  
                    this.itemTemplate = page.LoadTemplate(str);  
                }  
                else  
                {  
                    this.itemTemplate = new DefaultTemplate(this);  
                }  
            }  
        }  
        this.itemTemplate.InstantiateIn(this.cnt);  
        this.Controls.Add(this.cnt);  
        if ((this.CheckVisitorStatus(false) && string.IsNullOrEmpty(this.redirectionURL)) || this.IsResultsBoxRendered)  
        {  
            this.ShowResultsBox();  
            this.Manager.IncrementResultsViews(this.PollId, 1);  
        }  
        else if ((this.PollId != Guid.Empty) && (this.Manager.GetPollById(this.PollId) != null))  
        {  
            IPollItem pollById = this.Manager.GetPollById(this.PollId);  
            if (this.ShowTitle)  
            {  
                this.cnt.PollTitle.Text = pollById.Title;  
            }  
            ArrayList.Adapter(pollById.Questions).Sort(new SortOrderComparer());  
            this.validatorLabels = new ITextControl[pollById.Questions.Count];  
            this.listControls = new ListControl[pollById.Questions.Count];  
            this.placeHolders = new PlaceHolder[pollById.Questions.Count];  
            this.cnt.QuestionsList.DataSource = pollById.Questions;  
            this.cnt.QuestionsList.ItemCreated += new RepeaterItemEventHandler(this.QuestionsList_ItemCreated);  
            this.cnt.QuestionsList.DataBind();  
            this.cnt.VoteButton.Command += new CommandEventHandler(this.Button_Click);  
            if (this.ShowTotalVotesPreview)  
            {  
                this.cnt.VoteInfo.Text = string.Format(this.TotalVotersText, pollById.VoterNumber);  
                if (this.ShowResultsLink)  
                {  
                    this.cnt.ResultsLink.CausesValidation = false;  
                    this.cnt.ResultsLink.Command += new CommandEventHandler(this.resultsLink_Command);  
                }  
            }  
        }  
        thisthis.cnt.VoteButton.Text = this.buttonText;  

    to this one:

    protected override void CreateChildControls()  
    {  
        this.cnt = new PollBoxContainer(this);  
        if (this.itemTemplate == null)  
        {  
            string str = string.IsNullOrEmpty(this.TemplatePath) ? string.Empty : this.TemplatePath;  
            if (this.Page != null)  
            {  
                if (!(string.IsNullOrEmpty(str) || !File.Exists(this.Page.MapPath(str))))  
                {  
                    thisthis.itemTemplate = this.Page.LoadTemplate(str);  
                }  
                else  
                {  
                    this.itemTemplate = new DefaultTemplate(this);  
                }  
            }  
            else if (base.DesignMode)  
            {  
                Page page = new Page();  
                if (!(string.IsNullOrEmpty(str) || !File.Exists(HttpContext.Current.Request.MapPath(str))))  
                {  
                    this.itemTemplate = page.LoadTemplate(str);  
                }  
                else  
                {  
                    this.itemTemplate = new DefaultTemplate(this);  
                }  
            }  
        }  
        this.itemTemplate.InstantiateIn(this.cnt);  
        this.Controls.Add(this.cnt);  
        if ((this.CheckVisitorStatus(false) && string.IsNullOrEmpty(this.redirectionURL)) || this.IsResultsBoxRendered)  
        {  
            if (this.ShowResults)  
            {  
                this.ShowResultsBox();  
                this.Manager.IncrementResultsViews(this.PollId, 1);  
            }  
            else  
            {  
                if (this.cnt.AjaxControl != null)  
                {  
                    this.cnt.AjaxControl.Controls.Clear();  
                }  
                else  
                {  
                    this.Controls.Clear();  
                }  
     
                HtmlGenericControl span = new HtmlGenericControl("span");  
                span.InnerText = "Thank you for voting on this poll!";  
                this.Controls.Add(span);  
            }  
        }  
        else if ((this.PollId != Guid.Empty) && (this.Manager.GetPollById(this.PollId) != null))  
        {  
            IPollItem pollById = this.Manager.GetPollById(this.PollId);  
            if (this.ShowTitle)  
            {  
                this.cnt.PollTitle.Text = pollById.Title;  
            }  
            ArrayList.Adapter(pollById.Questions).Sort(new SortOrderComparer());  
            this.validatorLabels = new ITextControl[pollById.Questions.Count];  
            this.listControls = new ListControl[pollById.Questions.Count];  
            this.placeHolders = new PlaceHolder[pollById.Questions.Count];  
            this.cnt.QuestionsList.DataSource = pollById.Questions;  
            this.cnt.QuestionsList.ItemCreated += new RepeaterItemEventHandler(this.QuestionsList_ItemCreated);  
            this.cnt.QuestionsList.DataBind();  
            this.cnt.VoteButton.Command += new CommandEventHandler(this.Button_Click);  
            if (this.ShowTotalVotesPreview)  
            {  
                this.cnt.VoteInfo.Text = string.Format(this.TotalVotersText, pollById.VoterNumber);  
                if (this.ShowResultsLink)  
                {  
                    this.cnt.ResultsLink.CausesValidation = false;  
                    this.cnt.ResultsLink.Command += new CommandEventHandler(this.resultsLink_Command);  
                }  
            }  
        }  
        thisthis.cnt.VoteButton.Text = this.buttonText;  

    You can modify the "Thank you for voting on this poll!" text to the one you prefer. Hope this makes sense.

    Greetings,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  11. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    08 Feb 2008
    Link to this post
    That fixed it.  Thank you so much for your help.  This is my first experience using Sitefinity and I really appreciate how helpful you have been.  Thanks again, Nancy
  12. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    18 Feb 2008
    Link to this post
    Hello, I've noticed one more issue with the pollbox2 control.  I set "ShowResultsLink" to false, but the "Results" link still displays on the page.  When I click it, it just reloads the current page and doesn't show any results, but I'd rather not see the link at all.  Any ideas?  I also have ShowResults and IPBlocking set to False at this time, which is the desired settings in this case.  Thanks for your help. -Nancy
  13. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    20 Feb 2008
    Link to this post
    Hello Nancy,

    Unfortunately, we must confirm this is another problem in the PollBox control. It will be fixed for the next release and in case you need it currently, you can again modify your PollBox2 control by changing this code which is inside the CreateChildControls method:

    if (this.ShowTotalVotesPreview)  
    {  
        this.cnt.VoteInfo.Text = string.Format(this.TotalVotersText, pollById.VoterNumber);  
        if (this.ShowResultsLink)  
        {  
            this.cnt.ResultsLink.CausesValidation = false;  
            this.cnt.ResultsLink.Command += new CommandEventHandler(this.resultsLink_Command);  
        }  


    to this one:

    if (this.ShowTotalVotesPreview)  
    {  
        this.cnt.VoteInfo.Text = string.Format(this.TotalVotersText, pollById.VoterNumber);  
        if (this.ShowResultsLink)  
        {  
            this.cnt.ResultsLink.CausesValidation = false;  
            this.cnt.ResultsLink.Command += new CommandEventHandler(this.resultsLink_Command);  
        }  
        else 
            (this.cnt.ResultsLink as WebControl).Visible = false;  
    }  
    else 
    {  
        (this.cnt.VoteInfo as WebControl).Visible = false;  
    }  
    if (!this.ShowResultsLink)  
        (this.cnt.ResultsLink as WebControl).Visible = false

    Your Telerik account has been updated for reporting this.

    Best Regards,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  14. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    20 Feb 2008
    Link to this post
    I made that change and the class compiles, but throws a null reference exception when I put it in a page.  My settings are ShowResultsLink = false, ShowTotalVotesPreview = False, ShowResults = false and IPBlocking = true.

    If is change ShowTotalVotePreview to true, the error goes away.

    Any ideas?  Thanks again for your help, - Nancy
  15. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    21 Feb 2008
    Link to this post
    Hi Nancy,

    This is my omission. Sorry about that. The reason for this error is because I am casting a Literal control to WebConrol instead to Control directly. Anyway, it would be much safer if all the casts in the code I sent are to Control insted of WebControl. So the code should look to something like this:

    if (this.ShowTotalVotesPreview)  
    {  
        this.cnt.VoteInfo.Text = string.Format(this.TotalVotersText, pollById.VoterNumber);  
        if (this.ShowResultsLink)  
        {  
            this.cnt.ResultsLink.CausesValidation = false;  
            this.cnt.ResultsLink.Command += new CommandEventHandler(this.resultsLink_Command);  
        }  
        else 
            (this.cnt.ResultsLink as Control).Visible = false;  
    }  
    else 
    {  
        (this.cnt.VoteInfo as Control).Visible = false;  
    }  
    if (!this.ShowResultsLink)  
        (this.cnt.ResultsLink as Control).Visible = false

    Sorry once again.

    Sincerely yours,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  16. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    21 Feb 2008
    Link to this post
    Thanks for your help.  That seems to have solved the problem.
    -Nancy
Register for webinar
16 posts, 0 answered