Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PollId == 0)
        {
            return;
        }
        PollFormView.Visible = (Config.ActivePoll > 0 || PollId > 0);

        TopicInfo topic = (TopicInfo)Post;

        var polls = new List <PollInfo> {
            Polls.GetTopicPoll(PollId)
        };

        PollFormView.DataSource = polls;
        PollFormView.DataBind();
        Literal user = (Literal)PollFormView.FindControl("postedBy");

        if (user != null)
        {
            user.Text = "Asked by " + topic.AuthorProfilePopup;
        }
        buttonBar.Post = Post;
        //popuplink.Text = String.Format("<a href='{0}' title='{1}'>{2}</a>", topic.AuthorProfileLink, String.Format(Resources.webResources.lblViewProfile,topic.AuthorName), topic.AuthorName);
        //AuthorProfile.AuthorId = topic.AuthorId;
        msgBody.Text = topic.Message.ReplaceNoParseTags().ParseVideoTags().ParseWebUrls();
    }
Пример #2
0
    protected void ResultsDataListDataBinding(object sender, EventArgs e)
    {
        _totalVotes = Polls.GetTotalVotes(PollId);

        // Display the # of votes
        var totalVotesLabel = PollFormView.FindControl("TotalVotesLabel") as Label;

        if (totalVotesLabel != null)
        {
            totalVotesLabel.Text = string.Format("{0:d} votes...", _totalVotes);
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PollFormView.Visible = (Config.ActivePoll > 0 || ViewState["PollID"] != null);
        if (PollId == 0)
        {
            return;
        }

        var polls = new List <PollInfo> {
            Polls.GetTopicPoll(PollId)
        };

        PollFormView.DataSource = polls;
        PollFormView.DataBind();
    }
Пример #4
0
    // 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;
        }
    }