Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Comments
_Amy 26-Oct-12 8:54am    
What have you tried yet? Where you stuck?
Bhushan Shah1988 26-Oct-12 9:02am    
so what is your problem?
Member 9027483 27-Oct-12 1:33am    
i cant understand how i can match textbox value to gridvalue nd display grid data means at which point start coding nd where write code???
i m very confuse about this...

Filter your datatable according to your requirement. Try something like this:
C#
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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900