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
You can use condition to check rows exist in addition before casting. System.Linq namespace is required for Any() to work
var rows = values.AsEnumerable().Where
(row => row.Field("Status") == action);//get the rows where the status is equal to action
if(rows.Any())
{
DataTable dt = rows.CopyToDataTable();//Copying the rows into the DataTable as DataRow
}