protected void grdEmployers_SelectedIndexChanged(object sender, EventArgs e) { int eId = int.Parse(grdEmployers.SelectedDataKey.Value.ToString()); NORTHWNDEntities db = new NORTHWNDEntities(); grdFormView.DataSource = new List<Employee>() { db.Employees.FirstOrDefault(x => x.EmployeeID == eId) }; grdFormView.DataBind(); }
protected void grdEmployers_SelectedIndexChanged(object sender, EventArgs e) { int eId = int.Parse(grdEmployers.SelectedDataKey.Value.ToString()); NORTHWNDEntities db = new NORTHWNDEntities(); grdFormView.DataSource = new List <Employee>() { db.Employees.FirstOrDefault(x => x.EmployeeID == eId) }; grdFormView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int eId = int.Parse(Request.QueryString["id"]); NORTHWNDEntities db = new NORTHWNDEntities(); grdEmployerView.DataSource = new List <Employee>() { db.Employees.FirstOrDefault(x => x.EmployeeID == eId) }; grdEmployerView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int eId = int.Parse(Request.QueryString["id"]); NORTHWNDEntities db = new NORTHWNDEntities(); grdEmployerView.DataSource = new List<Employee>() { db.Employees.FirstOrDefault(x => x.EmployeeID == eId) }; grdEmployerView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NORTHWNDEntities db = new NORTHWNDEntities(); grdEmployers.DataSource = db.Employees.Select(x => new { Id = x.EmployeeID, FullName = x.FirstName + " " + x.LastName }).ToList(); grdEmployers.DataBind(); rEmployers.DataSource = db.Employees.ToList(); rEmployers.DataBind(); lvEmps.DataSource = db.Employees.ToList(); lvEmps.DataBind(); } }