GridView列降序排序

huangapple go评论45阅读模式
英文:

GridView Column sort in descending

问题

欢迎大家
我有一个简单的代码,用于在 GridView 中显示值
当排序时,结果是升序的
我想要相反的顺序

输入图像描述

我使用了这段代码
但我想要反转顺序

GridView1.DataSource = dt;
dt.DefaultView.Sort = "MYPoints";
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind(); 

谢谢帮助

英文:

welcome all
I have a simple code that displays the values in a GridView
When sorting, the result is ascending
I want the opposite

enter image description here

I used this code
But I want to reverse the order

GridView1.DataSource = dt;
dt.DefaultView.Sort = "MYPoints";
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind(); 

Thanks for help

答案1

得分: 0

这应该可以工作

dt.DefaultView.Sort = "MYPoints DESC";
英文:

this should work:

dt.DefaultView.Sort = "MYPoints DESC";

huangapple
  • 本文由 发表于 2023年2月6日 06:17:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75355899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定