Web/News.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace cosmos.Web
{
public partial class News : System.Web.UI.Page
{
public int pcount = 0; //总条数
public int classId;
protected void Page_Load(object sender, EventArgs e)
{
if (!int.TryParse(Request.Params["classId"] as string, out this.classId))
{
this.classId = 0;
}
if (!Page.IsPostBack)
{
RptBind("");
}
if ((Request.Params["classId"] != null) && (Request.Params["classId"].ToString() != ""))
{
int strId = Convert.ToInt32(Request.Params["classId"]);
RptBind("ClassId=" + strId + "");
}
}
#region 列表绑定
private void RptBind(string strWhere)
{
cosmos.BLL.NewsInfo bll = new cosmos.BLL.NewsInfo();
DataSet ds = bll.GetList(strWhere);
DataView dv = ds.Tables[0].DefaultView;
//利用PAGEDDAGASOURCE类来分页
PagedDataSource pds = new PagedDataSource();
AspNetPager1.RecordCount = dv.Count;
pds.DataSource = dv;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
//获得总条数
pcount = bll.GetCount(strWhere);
if (this.pcount < 0)
{
this.lbmsg.Visible = true;
this.lbmsg.Text = "暂时没有新闻";
}
//绑定数据
rptList.DataSource = pds;
rptList.DataBind();
}
#endregion
后面还有 7 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。