// This event handler fires when data is bound to the FormView. It shows either
    // the poll taking or poll results interface depending on the result of
    // CanUserTakePoll() method. If PollEnabled is false, then the poll results are
    // always shown, regardless of what CanUserTakePoll() returns.
    // EXTENSION POINT: If you want to modify what users can take the poll (such as allowing
    //                  anonymous users), modify the CanUserTakePoll() method...)
    protected void PollFormViewDataBound(object sender, EventArgs e)
    {
        // Determine if the user can take the poll
        bool showResults;

        if (!PollEnabled)
        {
            showResults = true;
        }
        else
        {
            showResults = !CanUserTakePoll();
        }

        // Show/hide the Panels based on the value of showResults
        var takePollPanel = PollFormView.FindControl("pnlTakePoll") as Panel;

        if (takePollPanel != null)
        {
            RadioButtonList choices = (RadioButtonList)takePollPanel.FindControl("rblPollAnswer");
            if (choices != null)
            {
                choices.DataSource = Polls.GetPollChoices(PollId);
                choices.DataBind();
            }
            takePollPanel.Visible = !showResults;
        }

        var pollResultsPanel = PollFormView.FindControl("pnlPollResults") as Panel;

        if (pollResultsPanel != null)
        {
            DataList results = (DataList)pollResultsPanel.FindControl("resultsDataList");
            if (results != null)
            {
                results.DataSource = Polls.GetResults(PollId);
                results.DataBind();
            }
            pollResultsPanel.Visible = showResults;
        }

        var viewCommentsPanel = PollFormView.FindControl("pnlPollComments") as Panel;
        var hTopicId          = PollFormView.FindControl("hidTopicId") as HiddenField;

        if (viewCommentsPanel != null)
        {
            if (hTopicId != null)
            {
                viewCommentsPanel.Visible = hTopicId.Value != "";
                if (hTopicId.Value != "")
                {
                    var lnk = viewCommentsPanel.FindControl("lnkTopic") as HyperLink;
                    if (lnk != null)
                    {
                        lnk.Text        = "View comments";
                        lnk.NavigateUrl = String.Format("~/Content/Forums/Topic.aspx?TOPIC={0}", hTopicId.Value);
                    }
                }
            }
            //string path = Page.Request.FilePath;
            //if (path.ToLower().Contains("topic.aspx"))
            //    viewCommentsPanel.Visible = false;
        }
    }