//<Snippet1>
        private void dataRepeater1_ItemValueNeeded(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemValueEventArgs e)
        {
            if (e.ItemIndex < Employees.Count)
            {
                switch (e.Control.Name)
                {
                case "txtFirstName":
                    e.Value = Employees[e.ItemIndex + 1].firstName;
                    break;

                case "txtLastName":
                    e.Value = Employees[e.ItemIndex + 1].lastName;
                    break;
                }
            }
        }
        //</Snippet1>
        //<Snippet2>
        private void dataRepeater1_ItemValuePushed(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemValueEventArgs e)
        {
            Employee emp = Employees[e.ItemIndex];

            switch (e.Control.Name)
            {
            case "txtFirstName":
                emp.firstName = e.Control.Text;
                break;

            case "txtLastName":
                emp.lastName = e.Control.Text;
                break;

            default:
                MessageBox.Show("Error during ItemValuePushed unexpected control: " + e.Control.Name);
                break;
            }
        }
Ejemplo n.º 3
0
        private void dtrDTR_ItemValueNeeded(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemValueEventArgs e)
        {
            if (e.ItemIndex < dtDTR.Rows.Count)
            {
                switch (e.Control.Name)
                {
                case "lblEmpID":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["EmployeeID"].ToString();
                    }
                    catch { }
                    break;

                case "lblEmpNo":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["EmployeeCode"].ToString();
                    }
                    catch { }
                    break;

                case "lblLoginName":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["LoginName"].ToString();
                    }
                    catch { }
                    break;

                case "lblEmpName":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["EmpName"].ToString();
                    }
                    catch { }
                    break;

                case "lblDepartment":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["DepartmentName"].ToString();
                    }
                    catch { }
                    break;

                case "lblJobTitle":
                    try
                    {
                        e.Value = dtDTR.Rows[e.ItemIndex]["JobTitle"].ToString();
                    }
                    catch { }
                    break;

                case "lblDateHired":
                    try
                    {
                        e.Value = Convert.ToDateTime(dtDTR.Rows[e.ItemIndex]["HireDate"]).ToShortDateString();
                    }
                    catch { }
                    break;
                }
            }
        }