关于对dataGrid和dataset排序的问题?

hlj321 2003-11-12 10:19:17
我按如下命令执行时为什么在DataGrid中显示的数据是没有排序的?我怎么样才能通过命令控制dataGrid中的数据进行排序。不是通过点击dataGrid的列标题!
是WinForm下的
this.dataSetDetail.Tables[0].DefaultView.Sort=strDetailSort;
this.dataGrid1.DataSource = this.dataSetDetail;
this.dataGrid1.DataMember = this.dataSetDetail.Tables[0].TableName;
...全文
32 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hlj321 2003-11-12
  • 打赏
  • 举报
回复
谢谢
haoliqi 2003-11-12
  • 打赏
  • 举报
回复
试试

this.dataGrid1.DataSource = this.dataSetDetail.Tables[0].DefaultView;
wuyanfeng 2003-11-12
  • 打赏
  • 举报
回复
问题出在:this.dataGrid1.DataMember = this.dataSetDetail.Tables[0].TableName;
应是:this.dataSetDetail.Tables[0].DefaultView.Sort=strDetailSort;
   this.dataGrid1.DataSource = this.dataSetDetail.Tables[0].DefaultView
   this.dataGrid1.DataBind();
hlj321 2003-11-12
  • 打赏
  • 举报
回复
各位大侠请进啊
hlj321 2003-11-12
  • 打赏
  • 举报
回复
up
hlj321 2003-11-12
  • 打赏
  • 举报
回复
我查看dataSetDetail.Tables[0].DefaultView时已经是对其进行排序了为什么在datagrid中显示的数据是没有排序的。

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧