Hi,
There is no LINQ query for updating the GirdView, rather you have to update the Datasource using LINQ and rebind the GirView.
check below links, for updating the datatable using LINQ,
Update DataTable using LINQ in C#[
^]
how to do bulk update using linq[
^]
LINQ will update 1 column at a time, if you want to update muultiple columns, repeat the code as shown below.
objDataTable.AsEnumerable().ToList().ForEach(p => p.SetField<int>("COlumn1", 10));
objDataTable.AccectChanges();
objDataTable.AsEnumerable().ToList().ForEach(p => p.SetField<string>("COlumn2", "New Value"));
objDataTable.AccectChanges();
if you want to update only selected rows based on the condition try as below.
objDataTable.AsEnumerable().Where(c => c.Fiels<int>("Coloumn1") == 10).ToList().ForEach(p => p.SetField<int>("COlumn1", 10));
objDataTable.AccectChanges();
objDataTable.AsEnumerable().Where(c => c.Fiels<int>("Coloumn1") == 10).ToList().ForEach(p => p.SetField<string>("COlumn2", "New Value"));
objDataTable.AccectChanges();
Later bind the gird view
GridView1.DataSource = objDataTable;
GridView1.DataBind();
hope it helps.