排序GridView控件绑定到数据表 [英] Sort GridView Bound to DataTable

查看:109
本文介绍了排序GridView控件绑定到数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含这个项目,我的工作对我所有的LINQ查询库。我能够得到LINQ结果一个DataTable并绑定了一个GridView控件显示数据。现在我需要做的GridView的排序。我已设置 AllowSorting =真正的,我必须在codebehind常规处理的事件的onSort。该方案使得它进入分拣程序就好了。

I have a repository that contains all of my LINQ queries for this project that I am working on. I am able to get the LINQ results to a DataTable and bind that to a gridview for displaying the data. Now I need to make the gridview sortable. I have set AllowSorting="true" and I have the OnSort event handled in a routine in the codebehind. The program makes it into the sorting routine just fine.

时手动排序我唯一的选择还是有排序中的onSort处理GridView的更简单的方法?

Is manual sort my only option or is there an easier way to sort the gridview in the OnSort handler?

推荐答案

我最终使用的此内容例如从MSDN和附加我自己的数据表,它是通过LINQ查询在我的仓库收购。

I ended up solving this problem using this example from MSDN and attaching my own datatable, which was acquired through a LINQ Query in my repository.

这篇关于排序GridView控件绑定到数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆