新闻模块之新闻列表-使用datalist 模块获取数据-页面表示层(Linq方式)-2

通过datalist的超链接传输过来的articleId,显示所需要的数据。

articleId的传输参考页面表示层(Linq方式)-1

-------所达到的效果-------------------------------------

------页面设计---------------------------------------------

----页面CS代码-----------------------------------------------

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int articleId = int.Parse(Request.QueryString["articleId"]);
BindNewInfo(articleId);
}
}
/// <summary>
/// 通过articleId获取新闻
/// </summary>
/// <param name="articleId"></param>
protected void BindNewInfo(int articleId)
{
Article art = null;
ArticleBLL artsystem = new ArticleBLL();
art = artsystem.GetNewInfo(articleId);
this.lblClassName.Text = art.Category.ClassName;
this.lblTitle.Text = art.Title;
this.lblDateTime.Text = art.DateTime.ToString().Substring(0, 10);
this.lblContent.Text = art.Content;
}

 

-------BLL层----------------

-------DLL层---------------

posted @ 2012-01-25 21:21  阿杜008  阅读(389)  评论(0编辑  收藏  举报