Esempio n. 1
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     if (!RequestHelper.IsPostBack())
     {
         PollProperties.ReloadData();
     }
 }
    /// <summary>
    /// Displays appropriate controls regarding set properties.
    /// </summary>
    private void DisplayControls(string selectedPage, bool forceReload)
    {
        PollProperties.Visible      = false;
        AnswerList.Visible          = false;
        PollSecurity.Visible        = false;
        PollView.Visible            = false;
        PollView.StopProcessing     = true;
        headerLinks.Visible         = false;
        pnlPollsBreadcrumbs.Visible = false;
        pnlPollsLinks.Visible       = false;
        AnswerEdit.Visible          = false;
        btnResetAnswers.Visible     = true;
        imgResetAnswers.Visible     = true;

        if (forceReload)
        {
            selectedPage        = "0";
            tabMenu.SelectedTab = 0;
        }

        // Display appropriate tab
        switch (selectedPage)
        {
        // Answer list
        case "1":
            AnswerList.Visible = true;
            AnswerList.PollId  = ItemID;
            AnswerList.ReloadData(true);
            headerLinks.Visible   = true;
            pnlPollsLinks.Visible = true;
            break;

        // Answer edit
        case "answersedit":
            headerLinks.Visible         = true;
            pnlPollsBreadcrumbs.Visible = true;
            pnlPollsLinks.Visible       = true;
            AnswerEdit.Visible          = true;
            AnswerEdit.PollId           = ItemID;
            AnswerEdit.ReloadData();
            btnResetAnswers.Visible = false;
            imgResetAnswers.Visible = false;
            AnswerEditSelected      = true;

            // Initialize breadcrumbs
            InitializeBreadcrumbs();
            break;

        // Poll security
        case "2":
            PollSecurity.Visible = true;
            PollSecurity.ItemID  = ItemID;
            PollSecurity.ReloadData();
            break;

        // Poll view
        case "3":
            PollView.Visible = true;
            InitPollView(ItemID);
            PollView.StopProcessing = false;
            PollView.ReloadData(false);
            break;

        // Poll properties
        default:
            PollProperties.Visible = true;
            PollProperties.ItemID  = ItemID;

            PollProperties.ReloadData();
            break;
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Displays appropriate controls regarding set properties.
    /// </summary>
    private void DisplayControls(string selectedPage, bool forceReload)
    {
        PollProperties.Visible      = false;
        AnswerList.Visible          = false;
        PollSecurity.Visible        = false;
        PollView.Visible            = false;
        PollView.StopProcessing     = true;
        headerLinks.Visible         = false;
        pnlPollsBreadcrumbs.Visible = false;
        pnlPollsLinks.Visible       = false;
        AnswerEdit.Visible          = false;
        btnResetAnswers.Visible     = true;
        imgResetAnswers.Visible     = true;

        if (forceReload)
        {
            selectedPage        = "0";
            tabMenu.SelectedTab = 0;
        }

        // Display appropriate tab
        switch (selectedPage)
        {
        // Poll properties
        case "0":
        default:
            PollProperties.Visible = true;
            PollProperties.ItemID  = ItemID;

            PollProperties.ReloadData();
            break;

        // Answer list
        case "1":
            AnswerList.Visible = true;
            AnswerList.PollId  = ItemID;
            AnswerList.ReloadData(true);
            headerLinks.Visible   = true;
            pnlPollsLinks.Visible = true;
            break;

        // Answer edit
        case "answersedit":
            headerLinks.Visible         = true;
            pnlPollsBreadcrumbs.Visible = true;
            pnlPollsLinks.Visible       = true;
            AnswerEdit.Visible          = true;
            AnswerEdit.PollId           = ItemID;
            AnswerEdit.ReloadData();
            btnResetAnswers.Visible = false;
            imgResetAnswers.Visible = false;
            AnswerEditSelected      = true;

            // Initialize breadcrumbs
            string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption");
            if (AnswerEdit.ItemID > 0)
            {
                PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(AnswerEdit.ItemID);
                if (pollAnswerObj != null)
                {
                    currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString();
                }
            }
            lblAnswer.Text = currentPollAnswer;
            break;

        // Poll security
        case "2":
            PollSecurity.Visible = true;
            PollSecurity.ItemID  = ItemID;
            PollSecurity.ReloadData();
            break;

        // Poll view
        case "3":
            PollView.Visible = true;
            InitPollView(ItemID);
            PollView.StopProcessing = false;
            PollView.ReloadData(false);
            break;
        }
    }