如何过滤网格数据 [英] how to filter data of grid

查看:111
本文介绍了如何过滤网格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想过滤网格数据..
我有下拉列表,其中表的列名称. //将下拉列表设为ddlcolm.
我还有另一个下拉菜单,其中的关键词是=> < //将下拉列表设置为ddlkeyword.
我有另一个文本框,我们可以在其中输入名称,id,状态值之类的数据

还有一个过滤器按钮...
所以我想从ddlcolm中选择列名,并从ddlkeyword中选择关键字,然后在文本框中输入日期...
假设在文本框中输入名称为party,然后单击过滤器按钮,然后我想在网格视图中显示名称为"party"的数据.


那我该怎么办??
请帮我...
在此先感谢..

i want to filter data of grid..
i have dropdown list in which column name of table. //assume dropdown list as ddlcolm.
i have another dropdown in which keyword like = > < //assumen dropdown as ddlkeyword.
i have another textbox in which we can enter data like name,id,status value

and one filter button is there...
so i want to select column name from ddlcolm and select keyword from ddlkeyword and enter date in textbox ...
suppose in textbox enter name is party nd click on filter button then i want to display in gridview data which name is ''party''.


so how can i do???
plz help me...
thanks in advance..

推荐答案

根据您的要求过滤数据表.尝试这样的事情:
Filter your datatable according to your requirement. Try something like this:
var query = (from s in dt.AsEnumerable()
               where s[ddlcolm.SelectedValue] equals TextBox1 select s);
DataTable FilteredData = query.Count() > 0 ? query.CopyToDataTable() : null;
if(FilteredData != null)
{
     //bind your grid-view here.
}



--Amit



--Amit


使用以下链接:

http://msdn.microsoft.com/en-us/library/bb470363 (v = vs.100).aspx [ http://msdn.microsoft.com/en-us/library/aa479353.aspx [ ^ ]
http://social.msdn.microsoft.com /Forums/zh-CN/winforms/thread/fc9eef3c-cb54-4b92-9c81-54c630793fa1/ [ http://stackoverflow.com/questions/12148993/如何在aspgrid中提供数据后过滤器 [
Use the following links :

http://msdn.microsoft.com/en-us/library/bb470363(v=vs.100).aspx[^]
http://msdn.microsoft.com/en-us/library/aa479353.aspx[^]
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/fc9eef3c-cb54-4b92-9c81-54c630793fa1/[^]
http://stackoverflow.com/questions/12148993/how-to-load-the-data-in-aspgrid-after-providing-filters[^]

Thanks,
Ambesha


这篇关于如何过滤网格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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