Asp.net源码专业站
首页->博客空间->SpaceBuilder v1.0正式版源码>>BasicWebControls/Manage/Forum/ManageForumSections.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
当前文件:文件类型 SpaceBuiderV10Source/BasicWebControls/Manage/Forum/ManageForumSections.cs[6K,2009-6-12 11:55:07]打开代码结构图
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections.Generic; 9using System.Text; 10using System.Web.UI.WebControls; 11using SpaceBuilder.Forums.Components; 12using SpaceBuilder.Clubs.Components; 13using SpaceBuilder.Controls.Utils; 14using System.Web.UI.HtmlControls; 15 16namespace SpaceBuilder.Web.Manage.Controls 17{ 18 public class ManageForumSections : ForumBaseControl 19 { 20 protected override void OnInit(EventArgs e) 21 { 22 if (SkinName == null) 23 { 24 SkinName = "Forums/Skin-ManageForumSections.ascx"; 25 } 26 base.OnInit(e); 27 } 28 29 ... 36 37 protected override void AttachChildControls() 38 { 39 addForumSection = FindControl("AddForumSection") as HyperLink; 40 forumSectionRepeater = FindControl("ForumSectionRepeater") as Repeater; 41 forumSectionRepeater.ItemDataBound += new RepeaterItemEventHandler(forumSectionRepeater_ItemDataBound); 42 forumSectionRepeater.ItemCommand += new RepeaterCommandEventHandler(forumSectionRepeater_ItemCommand); 43 //forumGroupName = FindControl("ForumGroupName") as Literal; 44 } 45 46 protected override void OnLoad(EventArgs e) 47 { 48 base.OnLoad(e); 49 EnsureChildControls(); 50 if (!Page.IsPostBack) 51 { 52 BindData(); 53 } 54 } 55 56 private void BindData() 57 { 58 this.SetPageTitle("版块管理"); 59 if (addForumSection != null) 60 { 61 addForumSection.NavigateUrl = ForumUrls.Instance().Manage_AddForumGroup(); 62 } 63 IList<Club> forumCategories = Clubs.Components.Clubs.GetForumGroups(true, true); 64 if (forumCategories != null) 65 { 66 forumSectionRepeater.DataSource = forumCategories; 67 forumSectionRepeater.DataBind(); 68 } 69 } 70 71 void forumSectionRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) 72 { 73 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) 74 { 75 Club forumCategory = (Club)e.Item.DataItem; 76 if (forumCategory != null) 77 { 78 Literal forumGroupName = e.Item.FindControl("ForumGroupName") as Literal; 79 if (forumGroupName != null) 80 { 81 forumGroupName.Text = forumCategory.ClubName; 82 } 83 Literal sortOrder = e.Item.FindControl("SortOrder") as Literal; 84 if (sortOrder != null) 85 { 86 sortOrder.Text = Convert.ToString(forumCategory.DisplayOrder); 87 } 88 LinkButton editButton = e.Item.FindControl("EditButton") as LinkButton; 89 if (editButton != null) 90 { 91 editButton.CommandArgument = forumCategory.ClubID.ToString(); 92 } 93 94 LinkButton addButton=e.Item.FindControl("AddButton") as LinkButton; 95 if (addButton != null) 96 { 97 addButton.CommandArgument = forumCategory.ClubID.ToString(); 98 } 99 ForumQuery query = new ForumQuery(); 100 query.ClubID = forumCategory.ClubID; 101 query.ForumType = ForumType.Normal; 102 query.OrganizeOption = ForumsOrganizeOption.Indented; 103 query.SortBy = SpaceBuilder.Posts.Components.SortSectionsBy.MostRecentPostDate; 104 query.ActiveStatus = SpaceBuilder.Components.ActiveStatus.All; 105 106 IList<Forum> forumsIn = Forums.Components.Forums.GetForumsByClubID(query); 107 //IList<Forum> forumsIn=new List<Forum>(); 108 //forumsIn = Forums.Components.Forums.GetForumsByClubID(query); 109 if (forumsIn.Count > 0) 110 { 111 HtmlTableRow forumSectionTr = e.Item.FindControl("ForumSectionTr") as HtmlTableRow; 112 if (forumSectionTr != null) 113 { 114 forumSectionTr.Visible = true; 115 } 116 ShowForumSections showForumSections = e.Item.FindControl("ShowForumSections") as ShowForumSections; 117 if (showForumSections != null) 118 { 119 showForumSections.ChildeForumSections = forumsIn; 120 showForumSections.ForumGroupID = forumCategory.ClubID; 121 } 122 } 123 LinkButton deleteButton = e.Item.FindControl("DeleteButton") as LinkButton; 124 if (deleteButton != null) 125 { 126 deleteButton.CommandArgument = forumCategory.ClubID.ToString(); 127 if (forumsIn.Count > 0) 128 { 129 deleteButton.Attributes["onclick"] = string.Format("if(!confirm(\"此版块组下的{0}个版块及其子版块将同时删除,您还确认要删除此版块组吗?\")) return false;", forumsIn.Count); 130 } 131 else 132 deleteButton.Attributes["onclick"] = "if(!confirm(\"确认要删除此版块组吗?\")) return false;"; 133 } 134 } 135 } 136 } 137 138 void forumSectionRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) 139 { 140 switch (e.CommandName) 141 { 142 case "Edit": 143 Context.Response.Redirect(ForumUrls.Instance().Manage_EditForumGroup(Convert.ToInt32(e.CommandArgument))); 144 break; 145 case "Delete": 146 Forums.Components.Forums.DeleteByClubID(Convert.ToInt32(e.CommandArgument)); 147 Clubs.Components.Clubs.DeleteClub(Convert.ToInt32(e.CommandArgument)); 148 BindData(); 149 break; 150 case "Add": 151 Context.Response.Redirect(ForumUrls.Instance().Manage_AddForumSection(Convert.ToInt32(e.CommandArgument))); 152 break; 153 default: 154 break; 155 } 156 } 157 } 158} 159
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilder v1.0正式版源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146