我的C#文章模块代码
生活随笔
收集整理的這篇文章主要介紹了
我的C#文章模块代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
不論在哪里都和文章模塊少不了打交道。。。。。
公告,新聞,故事等等。。。。
現在我就發一個自己用的文章模塊吧,就算是拋磚引玉吧。。。
前臺
前臺
代碼這真心不好看。。。只能怪這編輯器。。。太不給力了。。。前臺這里是兩個repeater的嵌套。。
categorymainr負責文章類別的輸出,而newsmainr負責各類別具體數目文章標題的輸出
后臺
綁定大類:categorymainr.DataSource = w_categoryBLL.SelectCategoryAll(); categorymainr.DataBind();
綁定文章:
protectedvoid categorymainr_ItemDataBound(object sender, RepeaterItemEventArgs e){ if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem){ Repeater newsmainr = (Repeater)e.Item.FindControl("newsmainr"); int id = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "id").ToString());newsmainr.DataSource = w_newsBLL.selectNewsByPage(-1, id, 1, 10);newsmainr.DataBind();}}
轉載于:https://blog.51cto.com/7219914/1210577
總結
以上是生活随笔為你收集整理的我的C#文章模块代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PostgreSQL在何处处理 sql查
- 下一篇: 版本效果MoonWarrior coco