Click here to Skip to main content
15,867,327 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to filter datatable row by user txtbox input , if any row have the input value then it save into another datatable.
can anyone plz help me....?
Posted
Comments
George Jonsson 9-Oct-15 23:45pm    
Not really clear what you want.
Please elaborate and maybe give examples of your table structures.
No one here can read your mind.
PIEBALDconsult 9-Oct-15 23:58pm    
Copying is probably not necessary. What do you intend to do with them once you copy them?

DataTable.DefaultView.RowFilter
http://www.codeproject.com/Tips/850878/On-Why-to-Use-DataViews
NagaNimesh 11474558 10-Oct-15 0:12am    
I have a datatable have some rows and columns with data... as per my UI user will provide some input value ...now my query is i need to search each row of my datatable..if any row field having user input then that row will copy to my new datatable according to same column...

Try
DataTable sourceTable = GetTable() //Original table
string filter = myFilter; //Put the filter here
DataView view = new DataView(sourceTable, filter, null, DataViewRowState.CurrentRows);
DataTable newTable = view.ToTable();
 
Share this answer
 
v2
Comments
NagaNimesh 11474558 10-Oct-15 0:13am    
"Filter expression '25010010' does not evaluate to a Boolean term."
im getting thsi error here 25010010 is my input value...???
Abhinav S 10-Oct-15 0:29am    
Try a filter like this "myColumnValue = 25010010". More help on filters - Filters.
NagaNimesh 11474558 10-Oct-15 0:53am    
have a doubt here searching not to be for a single column user enter field might be belongs to any column...so im trying to serach row data.. if any row contains this data then im trying to copy that row to new datatable having same column...bt the way i thing datarow will copy to new datatable...?
 
Share this answer
 

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