📄 viewitem.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace PSP
{
/// <summary>
/// Summary description for ViewItem.
/// </summary>
public class ViewItem : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Literal litFlash;
protected System.Web.UI.WebControls.TextBox txtBody;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label lblTitle;
protected System.Web.UI.WebControls.Literal Literal2;
protected System.Web.UI.WebControls.TextBox txtUrl;
protected System.Web.UI.WebControls.TextBox txtBlog;
protected System.Web.UI.WebControls.TextBox txtHtml;
protected System.Web.UI.WebControls.TextBox txtBBS;
protected System.Web.UI.WebControls.Label lblDesc;
protected System.Web.UI.WebControls.Label lblDate;
protected System.Web.UI.WebControls.Label lblView;
protected System.Web.UI.WebControls.HyperLink hplIcon;
protected System.Web.UI.WebControls.HyperLink hplRSS;
protected System.Web.UI.WebControls.HyperLink hplUser;
protected System.Web.UI.WebControls.Label lblSubscriber;
protected System.Web.UI.WebControls.Label lblItemNum;
protected System.Web.UI.WebControls.Literal Literal1;
protected System.Web.UI.WebControls.Label lblComment;
string _itemID;
string _userID;
private void Page_Load(object sender, System.EventArgs e)
{
_itemID = Request.QueryString["ItemID"];
if(! Page.IsPostBack)
{
DataRow dr = Framework.GetItem(_itemID);
string link = dr["ItemLink"].ToString();
if(! link.StartsWith("http://"))
{
string sss = Request.Url.AbsoluteUri;
int idx = sss.IndexOf("viewitem.aspx");
sss = sss.Substring(0, idx);
link = sss + link;
}
this.lblTitle.Text = dr["ItemTitle"].ToString();
this.litFlash.Text = CMS.GetFlashText(link);
this.lblView.Text = dr["ViewNum"].ToString();
this.lblDesc.Text = dr["ItemDesc"].ToString();
this.lblDate.Text = dr["CreatedDate"].ToString();
this.lblComment.Text = dr["CommentNum"].ToString();
this.txtUrl.Text = this.Page.Request.Url.AbsoluteUri;
this.txtBlog.Text = this.litFlash.Text;
this.txtBBS.Text = "[flash]" + link + "[/flash]";
this.txtHtml.Text = this.litFlash.Text;
this.hplRSS.NavigateUrl = "rss.aspx?UserID=" + dr["UserID"].ToString();
dr = Framework.GetUserInfo(dr["UserID"].ToString());
this.lblItemNum.Text = dr["ItemNum"].ToString();
this.hplIcon.ImageUrl = dr["Picture"].ToString();
this.hplIcon.NavigateUrl = "viewuser.aspx?username=" + dr["userName"].ToString();
this.hplUser.NavigateUrl = "viewuser.aspx?username=" + dr["userName"].ToString();
this.hplUser.Text = dr["userName"].ToString();
DataTable dt = Framework.GetRelatedItems(_itemID);
Literal1.Text = CMS.GenerateRelatedItemList(dt);
dt = Framework.GetItemComments(_itemID);
this.Literal2.Text = CMS.GenerateCommentList(dt);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
_userID = PSP.User.GetUserID(Page);
Framework.AddComment(_userID, _itemID, this.txtBody.Text);
DataTable dt = Framework.GetItemComments(_itemID);
this.Literal2.Text = CMS.GenerateCommentList(dt);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -