Esempio n. 1
0
        /// <summary>
        /// Handles the PollVoteButtonClick event of the ctrlPoll control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void ctrlPoll_PollVoteButtonClick(object sender, EventArgs e)
        {
            PollControl ctrlPoll = sender as PollControl;

            if (ctrlPoll != null)
            {
                string pollAnswerID = HttpUtility.UrlEncode(ctrlPoll.SelectedValue);
                string pollID       = HttpUtility.UrlEncode(ctrlPoll.PollID.ToString());

                string redirectUrl = string.Format("pollvote.aspx?PollID={0}&Poll_{0}={1}", pollID, pollAnswerID);
                Response.Redirect(redirectUrl);
            }
        }
        /// <summary>
        /// Initializes the poll control.
        /// </summary>
        protected void InitializePollControl()
        {
            int categoryID = CommonLogic.QueryStringUSInt("CategoryID");
            int sectionID  = CommonLogic.QueryStringUSInt("SectionID");

            // Search for the ID that you set in template.master
            PollControl ctrPoll = this.FindControl("ctrlPoll") as PollControl;

            // Check if valid first
            if (ctrPoll != null)
            {
                // Assign datasource,image,text,css.
                ctrPoll.DataSource     = Poll.Find(Customer.Current.CustomerID, categoryID, sectionID, Customer.Current.SkinID, 0, Customer.Current.LocaleSetting, Customer.Current.IsRegistered);
                ctrPoll.HeaderBGColor  = AppLogic.AppConfig("HeaderBGColor");
                ctrPoll.PollClass      = AppLogic.AppConfig("BoxFrameStyle");
                ctrPoll.HeaderImage    = string.Format("~/App_Themes/Skin_{0}/images/todayspoll.gif", Customer.Current.SkinID);
                ctrPoll.ButtonCssClass = "PollSubmit";
                ctrPoll.PollButtonText = AppLogic.GetString("polls.Vote", Customer.Current.SkinID, Customer.Current.LocaleSetting);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the ItemDataBound event of the dtlPolls control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.DataListItemEventArgs"/> instance containing the event data.</param>
        protected void dtlPolls_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                PollControl pc = e.Item.FindControl("ctrlPoll") as PollControl;
                if (pc != null)
                {
                    pc.DataSource = Poll.Find(ThisCustomer.CustomerID, 0, 0, ThisCustomer.SkinID, listOfPollID[e.Item.ItemIndex], ThisCustomer.LocaleSetting, ThisCustomer.IsRegistered);
                }

                if (listOfPollID.Count == 1)
                {
                    Panel pnlPoll = e.Item.FindControl("pnlPoll") as Panel;

                    if (pnlPoll != null)
                    {
                        Unit width = new Unit("690px");
                        pnlPoll.Width = width;
                    }
                }
            }
        }