In this article, I will show you, how to get data from Database table using EDMX file. Actually EDMX reduces lots of codes, you can see this article which contains lots of codes. EDMX file provides model as well as context class. By using public property of context class, we can communicate with the table. Before copy this code, first to add EDMX file in solution.
Source code
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
Code Behind
private void loadgrid()
{
//throw new NotImplementedException();
dbEntities dbe = new dbEntities();
var item = dbe.usertables.ToList();
GridView1.DataSource = item;
GridView1.DataBind();
}