How I can filter a dataTable with Linq to datatable?

前端 未结 3 1551
执念已碎
执念已碎 2020-12-14 02:59

hi how i can filter a datatable with linq to datatable? I have a DropDownList and there I can select the value of the Modul Column. Now I want to filter the DataTable with

3条回答
  •  时光说笑
    2020-12-14 03:02

    To Retrieve the DataTable based on filtering the list of item.(i.e.,if any of the list item is present in datatable, that matched result will received.

     Listitem=new List(){"TG1","TG2"};     
     DataTable tbsplit = (from a in tbl.AsEnumerable()
                  where item.Any(x => a.Field("CSubset").ToUpper().Contains(x.ToUpper()))
                  select a).CopyToDataTable();//By Executing this, the Filter DataTable is obtained
    

提交回复
热议问题