当前位置: 首页 > news >正文

合肥网站建设 乐云seo国外网站需要备案吗

合肥网站建设 乐云seo,国外网站需要备案吗,万网网站编辑,孝感注册公司阅读全文并下载例子 #xff1a;http://www.sufeinet.com/forum.php?modviewthreadtid190 以前不都是用table直接绑定DataGridView的#xff0c;没有出现过不能排序的问题#xff0c;初试List结果发现不管怎么样都不能实现排序的功能#xff0c;有朋友说 DataGridVie…   阅读全文并下载例子 http://www.sufeinet.com/forum.php?modviewthreadtid190   以前不都是用table直接绑定DataGridView的没有出现过不能排序的问题初试List结果发现不管怎么样都不能实现排序的功能有朋友说 DataGridView每一列都有个Sortable默认Automatic改成NotSortable了结果怎样还是不行啦。      还有朋友说 你可以拖一个bindingsource控件. bindingsource.datasource泛型集合 datagridview.datasourcebindingsource; 我发现也是不行那要怎么办呢查一下资料才知道     用泛型会失去DateTable的特性要实现System.Collections.Generic.IComparerT 才能实现排序  没有办法只能实现 一把了   看一下下面的代码吧 基本 是这样的 代码 using System;using System.ComponentModel;using System.Collections.Generic;using System.Reflection;namespace BaseFunction{    class ObjectPropertyCompareT : System.Collections.Generic.IComparerT     {        private PropertyDescriptor property;        private ListSortDirection direction;        public ObjectPropertyCompare(PropertyDescriptor property, ListSortDirection direction)        {            this.property  property;            this.direction  direction;        }        #region IComparerT        /// summary        /// 比较方法        /// /summary        /// param namex相对属性x/param        /// param namey相对属性y/param        /// returns/returns        public int Compare(T x, T y)        {            object xValue  x.GetType().GetProperty(property.Name).GetValue(x, null);            object yValue  y.GetType().GetProperty(property.Name).GetValue(y, null);            int returnValue;            if (xValue is IComparable)            {                returnValue  ((IComparable)xValue).CompareTo(yValue);            }            else if (xValue.Equals(yValue))            {                returnValue  0;            }            else            {                returnValue  xValue.ToString().CompareTo(yValue.ToString());            }            if (direction  ListSortDirection.Ascending)            {                return returnValue;            }            else            {                return returnValue * -1;            }        }        public bool Equals(T xWord, T yWord)        {            return xWord.Equals(yWord);        }        public int GetHashCode(T obj)        {            return obj.GetHashCode();        }        #endregion    }}   在实现了这个接口之后还不能急我们还要来写一个SortableBindingList T :BindingList T 的类用来绑定数据 基本实现   代码 using System;using System.ComponentModel;using System.Collections.Generic;using System.IO;using System.Runtime.Serialization.Formatters.Binary;using System.Text;namespace BaseFunction{    public class BindingCollectionT : BindingListT    {        private bool isSorted;        private PropertyDescriptor sortProperty;        private ListSortDirection sortDirection;        protected override bool IsSortedCore        {            get { return isSorted; }        }        protected override bool SupportsSortingCore        {            get { return true; }        }        protected override ListSortDirection SortDirectionCore        {            get { return sortDirection; }        }        protected override PropertyDescriptor SortPropertyCore        {            get { return sortProperty; }        }        protected override bool SupportsSearchingCore        {            get { return true; }        }        protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)        {            ListT items  this.Items as ListT;            if (items ! null)            {                ObjectPropertyCompareT pc  new ObjectPropertyCompareT(property, direction);                items.Sort(pc);                isSorted  true;            }            else            {                isSorted  false;            }            sortProperty  property;            sortDirection  direction;            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));        }        protected override void RemoveSortCore()        {            isSorted  false;            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));        }        //排序        public void Sort(PropertyDescriptor property, ListSortDirection direction)        {            this.ApplySortCore(property, direction);        }    }}   现 在应该流到怎么使用了其实很简单 直接  BindingCollectionobject  objList  new BindingCollectionobject(); objList 你的结果集; this.dataGridView1.DataSource  objList;   但是现在是问题是我的之前用的是List不想改而且调用的是Dll人家返回的就是一个List我没有办法改成BindingCollectionobject 啊。 想了半天还是想出来了只是不知道 在性能和别的方面怎么样所以把代码发上来大家讨论一下 我是这样实现 的 代码  //可以实现排序的类            BindingCollectionhistoryorderInfo objList  new BindingCollectionhistoryorderInfo();            //加载数据            foreach (historyorderInfo item in tmpList)            {                objList.Add(item);            }            dgvhistory.DataSource  objList;     这里的tmpList就是我之前使用的系统原本的List,我是使用了 foreach 把原来的数据导入到BindingCollection中的。 这样的确定是可以实现 我想要的效果的。不知道这样做有什么不到之处。希望能得到高人的指点啊呵呵  转载于:https://www.cnblogs.com/sufei/archive/2010/02/04/1663125.html
http://www.yutouwan.com/news/65845/

相关文章:

  • 模特公司网站模板珠海建网站设计
  • 内蒙古高等级公路建设开发有限责任公司网站wordpress默认账号密码忘记
  • 济南外贸网站建设公司排名wordpress 网页制作
  • 网站空间购买注意事项代理网址域名
  • 沧州网站建设设计定制自助网站建设平台
  • 客户网站建设问题销售型网站建设
  • 设计接单兼职网站搜狗推广停止了吗
  • 网站地区分站系统网络媒体广告代理
  • 邯郸市网站建设多少钱wordpress.备份
  • 优化图片传网站常州网站建设流程
  • 免费企业网站建设流程wordpress淘宝发货插件
  • 网站开发客户需求域名网站购买
  • 做网站反应快的笔记本有哪些国内最新军事新闻
  • 视频弹幕网站怎么做一分钟赚一元的游戏
  • 西安企业网站建设模板国外网站网页设计
  • a4网站建设阿里云个人网站建设书
  • 好用的手机网站主页淄博网站建设与推广
  • 上海模板开发建站wordpress在新窗口打开
  • 游戏网站建设表格台州汇客网站建设
  • 青岛装饰公司十强排名网络优化的目的
  • 网站服务器怎么进做网站用旧域名好不好
  • 快速域名网站备案免费制作图片生成器
  • 网站开发 浏览器兼容性正规漫画网站开发流程
  • 建设团购网站河南政务服务网查二建证书
  • 网上哪里给公司做网站wordpress 页面 html代码
  • 有教做鱼骨图的网站吗房产网签是什么意思
  • 电子商务网站建设与管理的实践报告网页设计与制作教程免费
  • 大数据技术建设网站设计平面创意
  • 大航母网站建设好不好无为住建设局网站
  • 网站需要怎么做的吗营销传播策略