protected void Page_Load(object sender, EventArgs e) { int id = int.Parse(this.Request["id"]); var context = new northwindEntities1(); var employee = context.Employees.Where(emp => emp.EmployeeID == id).ToList(); this.DetailsViewEmployee.DataSource = employee; this.DetailsViewEmployee.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var context = new northwindEntities1(); var employees = context.Employees.ToList(); this.GridViewEmployees.DataSource = employees; this.GridViewEmployees.DataBind(); } }