/// <summary> /// 列表行绑定 /// </summary> protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 Playngo_ClientZone_Event Event = e.Row.DataItem as Playngo_ClientZone_Event; if (Event != null && Event.ID > 0) { HyperLink hlEdit = e.Row.FindControl("hlEdit") as HyperLink; HyperLink hlMobileEdit = e.Row.FindControl("hlMobileEdit") as HyperLink; LinkButton btnRemove = e.Row.FindControl("btnRemove") as LinkButton; LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton; HyperLink hlNewsletter = e.Row.FindControl("hlNewsletter") as HyperLink; Literal liNewsletterClientID = e.Row.FindControl("liNewsletterClientID") as Literal; HyperLink hlRegisters = e.Row.FindControl("hlRegisters") as HyperLink; HyperLink hlRepeats = e.Row.FindControl("hlRepeats") as HyperLink; Literal liRepeatsClientID = e.Row.FindControl("liRepeatsClientID") as Literal; HyperLink HLEventTitle = e.Row.FindControl("HLEventTitle") as HyperLink; //设置按钮的CommandArgument btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Event.ID.ToString(); //设置删除按钮的提示 if (Event.Status == (Int32)EnumStatus.Recycle) { btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); } else { btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');"); } hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Event.ID.ToString(), "Events-Edit"); HLEventTitle.Text = Event.Title; HLEventTitle.NavigateUrl = CommonFriendlyUrls.FriendlyUrl(Event, ViewSettingT <Int32>("ClientZone_DisplayTab_Events", TabId), true, this); //获取用户名称 DotNetNuke.Entities.Users.UserInfo createUser = new DotNetNuke.Entities.Users.UserController().GetUser(PortalId, Event.CreateUser); e.Row.Cells[3].Text = createUser != null && createUser.UserID > 0 ? createUser.DisplayName : ""; //文章状态 e.Row.Cells[6].Text = EnumHelper.GetEnumTextVal(Event.Status, typeof(EnumStatus)); //格式化3种时间为短日期格式 e.Row.Cells[4].Text = Event.ReleaseDate.ToShortDateString(); e.Row.Cells[5].Text = Event.StartTime.ToShortDateString(); } } }
/// <summary> /// 绑定页面项 /// </summary> private void BindPageItem() { if (EventID > 0) { cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); cmdDelete.Visible = true; hlPreview.NavigateUrl = CommonFriendlyUrls.FriendlyUrl(EventItem, ViewSettingT <Int32>("ClientZone_DisplayTab_Events", TabId), true, this); hlPreview.Visible = true; } else { hlExportCSV.Attributes.Add("disabled", "disabled"); } hlAddJurisdiction.NavigateUrl = xUrl("Jurisdictions"); hlAddJurisdiction.Attributes.Add("onclick", String.Format("return confirm('{0}');", Localization.GetString("hlAddJurisdiction.Confirm", this.LocalResourceFile))); //插入图片按钮的连接 hlAddMedia.Attributes.Add("data-href", String.Format("{0}Resource_FeaturedImage.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Insert=true", ModulePath, PortalId, TabId, ModuleId, language)); ////插入用户按钮的连接 hlEventAuthor.Attributes.Add("data-href", String.Format("{0}Resource_EventAuthors.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}", ModulePath, PortalId, TabId, ModuleId, language)); //绑定状态代码 WebHelper.BindList(ddlEventStatus, typeof(EnumStatus)); WebHelper.BindList(ddlNotificationStatus, typeof(EnumNotificationStatus)); //非管理员时需要屏蔽掉的按钮 if (!IsAdministrator && !IsAdmin) { ddlEventStatus.Visible = false; divEventAuthor.Visible = false; divFeature.Visible = false; divTopStatus.Visible = false; } }