private void RebindOrders() { int employeeId = Convert.ToInt32(this.GridViewEmployees.SelectedValue); var context = new NorthwindEntities(); this.GridViewOrders.DataSource = context.Orders.Where(o => o.EmployeeID == employeeId).ToList(); this.GridViewOrders.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var context = new NorthwindEntities(); this.GridViewEmployees.DataSource = context.Employees.ToList(); this.GridViewEmployees.DataBind(); this.RebindOrders(); } }