`
lonestone
  • 浏览: 90821 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

给你的cs(communityserver2.0)装上论坛跳转下拉菜单!

阅读更多

cs的很多不同之处,造成了很多用户的使用上的不习惯。但是我们又不能对cs做太多的修改,那样就不是cs了,何况升级也不便。

其实cs已经为我们提供了一个论坛下拉菜单,不过是用在最新帖子列表页面的,采用的是自动回发的方法,用在其它版面就不合适了。所以我简单的继承了这个控件,用一个新的类ForumJumpDropDownList.cs,就生成了一个采用js跳转的新控件:论坛快速跳转下拉菜单,代码如下:

//------------------------------
//www.cnfdc.com.cn
//王勇2006-8-21
//wangyong.yichang@gmail.com
//-----------------------------
usingSystem;
usingSystem.Collections;
usingSystem.Web.UI.WebControls;

usingCommunityServer.Components;
usingCommunityServer.Discussions.Components;

namespaceCommunityServer.Discussions.Controls
...{
/**////<summary>
///论坛跳转下拉菜单,继承自ForumDropDownList
///</summary>

publicclassForumJumpDropDownList:ForumDropDownList
...{
publicForumJumpDropDownList()
...{
stringscript=string.Empty;
script
=@"if(this.value!='f--1'){if(this.value.indexOf('g-')>=0){window.location.href='/forums/default.aspx?GroupID='+this.value.replace('g-','')}elseif(this.value.indexOf('f-')>=0){window.location.href='/forums/'+this.value.replace('f-','')+'/ShowForum.aspx'}}";
this.Attributes.Add("onchange",script);
}

}

}

重新编译这个dll,然后再在View-Threads.ascx的相应位置加入这个控件,就可以啦

跳转论坛到:<CSD:ForumJumpDropDownListID="ForumJumpDropDownList1"runat="server"/>

就这么简单!试试看吧!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics