ASP.Net2.0 GridView 多列排序,显示排序图标,分页(1)
点击次数:25 次 发布日期:2008-11-26 12:15:17 作者:源代码网
|
源代码网推荐 源代码网推荐 第一:GridView 多列排序与排序图标显示 源代码网推荐 源代码网推荐 首先我们可以新建一个类库程序,主要需要引用System.Web.Dll文件 源代码网推荐 然后新建一个类,这个类继承与GridView控件,我们只需要对部分方法进行重新即可。 源代码网推荐 我的演示的例子,采用了单列排序,如果启用多列排序,把控件的AllowMultiColumnSorting设置为True就是 源代码网推荐 多列排序。 源代码网推荐 源代码网推荐 源代码网推荐 1 public class WebGridView:GridView 源代码网推荐 2 { 源代码网推荐 3 属性#region 属性 源代码网推荐 4 /**//// <summary> 源代码网推荐 5 /// 是否启用或者禁止多列排序 源代码网推荐 6 /// </summary> 源代码网推荐 7 [ 源代码网推荐 8 Description("是否启用多列排序功能"), 源代码网推荐 9 Category("排序"), 源代码网推荐 10 DefaultValue("false"), 源代码网推荐 11 ] 源代码网推荐 12 public bool AllowMultiColumnSorting 源代码网推荐 13 { 源代码网推荐 14 get 源代码网推荐 15 { 源代码网推荐 16 object o = ViewState["EnableMultiColumnSorting"]; 源代码网推荐 17 return (o != null ? (bool)o : false); 源代码网推荐 18 } 源代码网推荐 19 set 源代码网推荐 20 { 源代码网推荐 21 AllowSorting = true; 源代码网推荐 22 ViewState["EnableMultiColumnSorting"] = value; 源代码网推荐 23 } 源代码网推荐 24 } 源代码网推荐 25 /**//// <summary> 源代码网推荐 26 /// 升序时显示图标 源代码网推荐 27 /// </summary> 源代码网推荐 源代码网推荐 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
