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

 

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

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

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

using  CommunityServer.Components;
using  CommunityServer.Discussions.Components;

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

    public class ForumJumpDropDownList : ForumDropDownList
    
{
        
public ForumJumpDropDownList()
        
{
            
string script = 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-','')}else if(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:ForumJumpDropDownList  ID ="ForumJumpDropDownList1"  runat ="server"   />

就这么简单!试试看吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值