码迷,mamicode.com
首页 > 其他好文 > 详细

十多个

时间:2015-05-13 16:03:39      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Web;
 5 using System.Web.UI;
 6 using System.Web.UI.WebControls;
 7 
 8 namespace MyWebsite.UI
 9 {
10     public partial class Index : System.Web.UI.Page
11     {
12         BLL.T_Article bll_article = new BLL.T_Article();
13         List<Model.APageArticleData> listarticle;
14         public int pageIndex;
15         public int pageCount;
16         public int articleCount;
17         protected void Page_Load(object sender, EventArgs e)
18         {
19             if(!IsPostBack)
20             {
21                 pageIndex = Convert.ToInt32(Request.QueryString["PageIndex"]);
22                 
23                 if (pageIndex == 0)
24                 {
25                     pageIndex = 1;
26                 }
27                 DataBindRP(pageIndex);
28                 articleCount = bll_article.GetCount();
29             }
30         }
31 
32         private void DataBindRP(int _pageIndex)
33         {
34             List<Model.Date> listdate = new List<Model.Date>();
35             listarticle = bll_article.GetAPageData(_pageIndex, 10, out pageCount, out listdate);
36             if (listarticle == null)
37             {
38                 pageIndex = 1;
39                 pageCount = 1;
40             }
41             Repeater_ArticleDate.DataSource = listdate;
42             Repeater_ArticleDate.DataBind();
43         }
44 
45         private List<Model.APageArticleData> GetADayData(string date)
46         {
47             List<Model.APageArticleData> list = new List<Model.APageArticleData>();
48             foreach (Model.APageArticleData mod in listarticle)
49             {
50                 if (date == bll_article.GetDate(mod.PublicTime))
51                 {
52                     list.Add(mod);
53                 }
54             }
55             if (list.Count > 0)
56             {
57                 return list;
58             }
59             else
60             {
61                 return null;
62             }
63         }
64 
65         protected void Repeater_ArticleDate_ItemDataBound(object sender, RepeaterItemEventArgs e)
66         {
67             string d = ((MyWebsite.Model.Date)(e.Item.DataItem)).Date_;
68             Repeater prnc = (Repeater)e.Item.FindControl("Repeater_Article");
69             prnc.DataSource = GetADayData(d);
70             prnc.DataBind();
71         }
72         
73     }
74 }
View Code

 

十多个

标签:

原文地址:http://www.cnblogs.com/wangzhezhifenfeng/p/4500434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!