📄 showpostbyidcontrol.ascx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ShowPostByIDControl : System.Web.UI.UserControl
{
#region
//属性标题
public string Title
{
set
{
lblTitle.Text = "主题:"+value;
ViewState["Title"] = value;
}
}
public string Writer
{
set
{
lblWriter.Text = value;
ViewState["Writer"] = value;
if(((UserEntity)Session["User"]).UserName==value)
{
hlkEdit.Visible=true;
}
}
}
public string PostTime
{
set
{
lblPostTime.Text = "发布于"+value;
ViewState["PostTime"] = value;
}
}
public string Content
{
set
{
lblContent.Text = value;
ViewState["Content"] = value;
}
}
public string LastModified
{
set
{
if (value != "")
{
lblLastModified.Text = "最后修改于:"+value;
lblLastModified.Visible = true;
ViewState["LastModified"] = value;
}
}
}
public string PostID
{
get
{
return ViewState["PostID"].ToString();
}
set
{
hlkEdit.NavigateUrl = "editPost.aspx?postid=" + value;
ViewState["PostID"] = value;
}
}
public string AttachmentID
{
get
{
return ViewState["AttachmentID"].ToString();
}
set
{
if (value != "")
{
hlkAttachment.NavigateUrl = "ShowAttachment.aspx?attachmentid=" + value;
hlkAttachment.Visible = true;
ViewState["AttachmentID"] = value;
lkbtnDelete.Visible = true;
}
}
}
public string ItemID
{
get
{
return ViewState["ItemID"].ToString();
}
set
{
ViewState["ItemID"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lkbtnDelete_Click(object sender, EventArgs e)
{
ArticleBussiness artBuss = new ArticleBussiness();
ArticleEntity art = new ArticleEntity();
art.PostID = Convert.ToInt32(PostID);
if (AttachmentID != null)
{
art.AttachmenID = Convert.ToInt32(AttachmentID);
}
artBuss.DeletePost(art);
Response.Redirect("ShowItem.aspx?itemid="+ItemID,true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -