/// <summary> /// Displays controls in dependence on properties. /// </summary> public override void ReloadData(bool forceReload) { base.ReloadData(forceReload); // Setup button imgNewPoll.ImageUrl = GetImageUrl("Objects/Polls_Poll/add.png"); imgNewPoll.AlternateText = GetString("polls_new.newitemcaption"); btnNewPoll.ResourceString = "Polls_List.NewItemCaption"; // Setup breadcrumbs btnBreadCrumbs.ResourceString = "Polls_Edit.itemlistlink"; // Setup panels pnlPollsHeaderLinks.Visible = false; pnlPollsHeaderBreadCrumbs.Visible = false; pnlList.Visible = false; pnlEdit.Visible = false; pnlPollNew.Visible = false; // Display appropriate poll controls switch (SelectedControl) { case "new": { pnlPollsHeaderBreadCrumbs.Visible = true; pnlPollNew.Visible = true; PollNew.ReloadData(); lblPoll.ResourceString = "polls_new.newitemcaption"; break; } case "edit": { pnlPollsHeaderBreadCrumbs.Visible = true; pnlEdit.Visible = true; PollEdit.ReloadData(true); PollInfo pi = PollInfoProvider.GetPollInfo(this.ItemID); if (pi != null) { lblPoll.ResourceString = null; lblPoll.Text = HTMLHelper.HTMLEncode(pi.PollDisplayName); } break; } case "list": default: { if (!dataLoaded || forceReload) { pnlPollsHeaderLinks.Visible = true; pnlList.Visible = true; PollsList.GroupId = GroupID; PollsList.ReloadData(); dataLoaded = true; } break; } } }
/// <summary> /// New poll click handler. /// </summary> private void btnNewPoll_Click(object sender, EventArgs e) { ItemID = 0; PollEdit.ItemID = 0; PollEdit.ReloadData(true); PollNew.ItemID = 0; PollNew.ClearForm(); SelectedControl = "new"; ReloadData(); }
/// <summary> /// New poll saved event handler. /// </summary> private void PollNew_OnSaved(object sender, EventArgs e) { // Handle events only from visible controls if (PollNew.Visible) { ItemID = PollNew.ItemID; PollEdit.ItemID = PollNew.ItemID; PollEdit.ReloadData(true); SelectedControl = "edit"; ReloadData(); } }
/// <summary> /// Displays controls in dependence on properties. /// </summary> public override void ReloadData(bool forceReload) { base.ReloadData(forceReload); // Setup button imgNewPoll.ImageUrl = GetImageUrl("Objects/Polls_Poll/add.png"); imgNewPoll.AlternateText = GetString("polls_new.newitemcaption"); btnNewPoll.ResourceString = "Polls_List.NewItemCaption"; // Setup panels pnlPollsHeaderLinks.Visible = false; pnlPollsHeaderBreadCrumbs.Visible = false; pnlList.Visible = false; pnlEdit.Visible = false; pnlPollNew.Visible = false; // Display appropriate poll controls switch (SelectedControl) { case "new": { pnlPollsHeaderBreadCrumbs.Visible = true; pnlPollNew.Visible = true; PollNew.ReloadData(); break; } case "edit": { pnlPollsHeaderBreadCrumbs.Visible = true; pnlEdit.Visible = true; PollEdit.ReloadData(true); break; } case "list": default: { if (!dataLoaded || forceReload) { pnlPollsHeaderLinks.Visible = true; pnlList.Visible = true; PollsList.GroupId = GroupID; PollsList.ReloadData(); dataLoaded = true; } break; } } InitializeBreadcrumbs(); }