Web/news_index.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web
{
    public partial class news_index : System.Web.UI.Page
    {
        protected string webtitle = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id;
                if (int.TryParse(Request.QueryString["id"], out id))
                {
                    BLL.article_category bllcat = new BLL.article_category();
                    this.rptList_cat.DataSource = bllcat.GetChildList(id, 1);
                    this.rptList_cat.DataBind();//当前一级菜单下左侧二级栏目

                    Model.article_category model = bllcat.GetModel(id);

                    Litlocal4.Text = model.title;

                    articleBind();//绑定一级栏目下子栏目
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
        }

        #region 绑定一级栏目下子栏目=================================
        protected void articleBind()
        {
            int id;
            if (int.TryParse(Request.QueryString["id"], out id))
            {
                BLL.article_category bllcat = new BLL.article_category();
                this.repCategory.DataSource = bllcat.GetList(id, 1);
                this.repCategory.DataBind();//当前一级菜单下二级栏目
                Model.article_category model = bllcat.GetModel(id);
                webtitle = model.title;
            }
        }

        protected void bsClassList(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                int ID = Convert.ToInt32(((DataRowView)e.Item.DataItem).Row["ID"].ToString());//获得对应ID
                Repeater sClass = (Repeater)e.Item.FindControl("childCategory");//找到要绑定数据的Repeater
                if (sClass != null)
                {
                    BLL.article bll = new BLL.article();
                    sClass.DataSource = bll.GetList(10, "status=0  and  category_id=" + ID, "is_top desc, sort_id asc, add_time desc");
                    sClass.DataBind();
                }
后面还有 21 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。