/// <summary> /// State DropDownList Selection change. /// </summary> protected void uniSelectorState_OnSelectionChanged(object sender, EventArgs e) { // Raise change event RaiseOnChanged(); // Update parent update panel if exists (e.g. the web part's one) var parentUpdatePanel = ControlsHelper.GetUpdatePanel(this); parentUpdatePanel?.Update(); }
/// <summary> /// Raise post-back event /// </summary> /// <param name="eventArgument">Argument</param> public void RaisePostBackEvent(string eventArgument) { if (!string.IsNullOrEmpty(eventArgument)) { string[] argValues = eventArgument.Split(';'); if (argValues.Length == 2) { CommandEventArgs args = new CommandEventArgs(argValues[0], argValues[1]); RaiseActionPerformed(this, args); // Update parent update panel in conditional mode var up = ControlsHelper.GetUpdatePanel(this); if ((up != null) && (up.UpdateMode == UpdatePanelUpdateMode.Conditional)) { up.Update(); } } } }
/// <summary> /// OnPrerender check whether. /// </summary> protected override void OnPreRender(EventArgs e) { postTreeElem.Selected = ValidationHelper.GetInteger(hdnSelected.Value, SelectedPost); if ((mSelectedPost == 0) && (RequestHelper.IsAJAXRequest())) { mSelectedPost = postTreeElem.Selected; } if (mSelectedPost > 0) { ForumPostInfo fpi = ForumPostInfoProvider.GetForumPostInfo(mSelectedPost); if ((fpi != null) && (ForumContext.CurrentForum != null) && (fpi.PostForumID == ForumContext.CurrentForum.ForumID)) { plcPostPreview.Visible = true; ltlPostSubject.Text = HTMLHelper.HTMLEncode(fpi.PostSubject); ltlPostText.Text = ResolvePostText(fpi.PostText); ltlSignature.Text = GetSignatureArea(fpi, "<div class=\"SignatureArea\">", "</div>"); ltlPostTime.Text = TimeZoneHelper.ConvertToUserTimeZone(fpi.PostTime, false, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite).ToString(); ltlPostUser.Text = "<span class=\"PostUserName\">" + GetUserName(fpi) + "</span>"; ltlAvatar.Text = AvatarImage(fpi); mUnapproved = !fpi.PostApproved ? " Unapproved" : ""; if (ForumContext.CurrentForum.ForumEnableAdvancedImage) { ltlPostText.AllowedControls = ControlsHelper.ALLOWED_FORUM_CONTROLS; } else { ltlPostText.AllowedControls = "none"; } attachmentDisplayer.ClearData(); attachmentDisplayer.PostID = fpi.PostId; attachmentDisplayer.PostAttachmentCount = fpi.PostAttachmentCount; attachmentDisplayer.ReloadData(); #region "Badge" if (DisplayBadgeInfo) { if (fpi.PostUserID > 0) { UserInfo ui = UserInfoProvider.GetUserInfo(fpi.PostUserID); if ((ui != null) && (!ui.IsPublic())) { BadgeInfo bi = BadgeInfoProvider.GetBadgeInfo(ui.UserSettings.UserBadgeID); if (bi != null) { ltlBadge.Text = "<div class=\"Badge\">" + HTMLHelper.HTMLEncode(bi.BadgeDisplayName) + "</div>"; if (!String.IsNullOrEmpty(bi.BadgeImageURL)) { ltlBadge.Text += "<div class=\"BadgeImage\"><img alt=\"" + HTMLHelper.HTMLEncode(bi.BadgeDisplayName) + "\" src=\"" + HTMLHelper.HTMLEncode(GetImageUrl(bi.BadgeImageURL)) + "\" /></div>"; } } } } // Set public badge if no badge is set if (String.IsNullOrEmpty(ltlBadge.Text)) { ltlBadge.Text = "<div class=\"Badge\">" + GetString("Forums.PublicBadge") + "</div>"; } } #endregion #region "Post actions" // Get the parent thread ID (for reply and quote) int threadId = ForumPostInfoProvider.GetPostRootFromIDPath(fpi.PostIDPath); ltlReply.Text = GetLink(fpi, GetString("Forums_WebInterface_ForumPost.replyLinkText"), "PostActionLink", ForumActionType.Reply, threadId); ltlQuote.Text = GetLink(fpi, GetString("Forums_WebInterface_ForumPost.quoteLinkText"), "PostActionLink", ForumActionType.Quote, threadId); ltlSubscribe.Text = GetLink(fpi, GetString("Forums_WebInterface_ForumPost.Subscribe"), "PostActionLink", ForumActionType.SubscribeToPost, threadId); ltlAnswer.Text = GetLink(fpi, GetString("general.yes"), "ActionLink", ForumActionType.IsAnswer); ltlNotAnswer.Text = GetLink(fpi, GetString("general.no"), "ActionLink", ForumActionType.IsNotAnswer); if (ltlAnswer.Text != String.Empty) { ltlWasHelpful.Text = GetString("Forums_WebInterface_ForumPost.Washelpful") + " "; ltlAnswer.Text += "|"; } ltlAddPostToFavorites.Text = GetLink(fpi, GetString("Forums_WebInterface_ForumPost.AddPostToFavorites"), "ActionLink", ForumActionType.AddPostToFavorites); ltlDelete.Text = GetLink(fpi, GetString("general.delete"), "ActionLink", ForumActionType.Delete); ltlEdit.Text = GetLink(fpi, GetString("general.edit"), "ActionLink", ForumActionType.Edit); ltlAttachments.Text = GetLink(fpi, GetString("general.attachments"), "ActionLink", ForumActionType.Attachment); #endregion // Hide separators if ((ltlReply.Text == "") || (ltlReply.Text != "" && ltlQuote.Text == "")) { plcFirstSeparator.Visible = false; } if ((ltlSubscribe.Text == "") || (ltlSubscribe.Text != "" && ltlQuote.Text == "")) { plcSecondSeparator.Visible = false; } if (ltlReply.Text != "" && ltlSubscribe.Text != "") { plcFirstSeparator.Visible = true; } pnlManage.Visible = (EnableOnSiteManagement && (ForumContext.CurrentForum != null)) ? ForumContext.UserIsModerator(ForumContext.CurrentForum.ForumID, CommunityGroupID) : false; if (pnlManage.Visible) { ltlApprove.Text = GetLink(fpi, GetString("general.approve"), "ActionLink", ForumActionType.Appprove); ltlApproveAll.Text = GetLink(fpi, GetString("forums.approveall"), "ActionLink", ForumActionType.ApproveAll); ltlReject.Text = GetLink(fpi, GetString("general.reject"), "ActionLink", ForumActionType.Reject); ltlRejectAll.Text = GetLink(fpi, GetString("forums.rejectall"), "ActionLink", ForumActionType.RejectAll); ltlSplit.Text = GetLink(fpi, GetString("forums.splitthread"), "ActionLink", ForumActionType.SplitThread); ltlMove.Text = GetLink(fpi, GetString("forums.movethread"), "ActionLink", ForumActionType.MoveToTheOtherForum, threadId); } } } else { plcPostPreview.Visible = false; } if (ControlsHelper.IsInUpdatePanel(this)) { ControlsHelper.GetUpdatePanel(this).Update(); } base.OnPreRender(e); }