/// <summary> /// 列表行绑定 /// </summary> protected void gvCommentList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //还原出数据 FontDB FontItem = e.Row.DataItem as FontDB; if (FontItem != null && !String.IsNullOrEmpty(FontItem.PrimaryGuid)) { #region "编辑&删除按钮" 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; //设置按钮的CommandArgument btnRemove.CommandArgument = btnMobileRemove.CommandArgument = FontItem.PrimaryGuid; //设置删除按钮的提示 //if (Media.Status == (Int32)EnumFileStatus.Recycle) //{ if (FontItem.IsFontLink.HasValue && FontItem.IsFontLink.Value) { hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("PrimaryGuid", FontItem.PrimaryGuid, "AddFontByGoogle"); } else { hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("PrimaryGuid", FontItem.PrimaryGuid, "AddFontByUpload"); } if (FontItem.IsSystem.HasValue && !FontItem.IsSystem.Value) { btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); } else { btnRemove.Visible = btnRemove.Enabled = false; btnMobileRemove.Visible = btnMobileRemove.Enabled = false; } //} //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?") + "');"); //} #endregion //发布时间 e.Row.Cells[4].Text = FontItem.CreateTime.ToShortDateString(); e.Row.Cells[3].Text = FontItem.UpdateTime.ToShortDateString(); //系统字体 e.Row.Cells[6].Text = EnumHelper.GetEnumTextVal(FontItem.IsSystem.HasValue && FontItem.IsSystem.Value ? 1 : 0, typeof(EnumFontSystem)); //外部链接字体 e.Row.Cells[5].Text = EnumHelper.GetEnumTextVal(FontItem.IsFontLink.HasValue && FontItem.IsFontLink.Value ? 1 : 0, typeof(EnumFontLink)); } } }
/// <summary> /// 保存并提交 /// </summary> /// <param name="i"></param> public void SaveCommit(FontDB i) { Save(i); Commit(); }