Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdventureWorks_DataEntities adventureWorks_DataEntities =
                new AdventureWorks_DataEntities();

            var query = from emp in adventureWorks_DataEntities.Employees
                        select emp;

            GridView1.DataSource = query;
            GridView1.DataBind();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdventureWorks_DataEntities adventureWorks_DataEntities = new AdventureWorks_DataEntities();

            foreach (var employee in adventureWorks_DataEntities.Employee)
            {
                ListItem li = new ListItem();

                li.Text = employee.EmployeeID + " ";

                if (!employee.EmployeePayHistory.IsLoaded)
                {
                    employee.EmployeePayHistory.Load();
                }

                foreach (var pay in employee.EmployeePayHistory)
                {
                    li.Text += "Pay Rate: " + pay.Rate + " ";
                }

                BulletedList1.Items.Add(li);
            }
        }