Editing Gridview Using LINQ

       This article describes the easiest way of editing gridview by using LINQ data source and 

       DataContext.

       Explained step by step as below,

1)      Create DataContext using Northwind Database.

 Drag and drop the Product table in to Northwind.dbml datacontext, as shown below.

 

2)      Add Grid view to webform and choose datasource for the Gridview.

Choose new datasource as LINQ which will add new LINQ datasource to page as shown below.

 

3)      Configure the datasource

Choose the all column of the Product Table and also tick the advanced options.

 

 

 

And enable the editing option of the grid view.

 

  

 

Yes you are done! When you run page you will see the grid is populated with all products and you also find the edit link with each row as shown below.