Bind data in a gridview using entity framework
   Process to add entity framework in

  Right click on solution=> add ADO.net entity data model
  =>give the name of model 

  =>select EfDesignerDatabase


   
  =>select database entity name


 =>select checkbox of table


 Now u can see that a modelName.edmx file is added. So with the help of database entity u can  add or modify data to database directly without using API.


Write below code in aspx.cs page

Grid.aspx.cs

inductionEntities en = new inductionEntities();
        protected void bind()
        {
            var r = (from a in en.Employees
                     select a).ToList();
            GridView1.DataSource = r;
            GridView1.DataBind();
 }




Comments

Popular posts from this blog

Kendo Control(Dynamics)

Override Authorize Filters in MVC

Form Validation