private void BindEmployeeReportsTo() { DropDownListEmployee.Items.FindByValue(this.employeeId.ToString()).Selected = true; DropDownListEmployee.Enabled = false; DropDownListReportsTo.ClearSelection(); if (this.add == "True") { DropDownListReportsTo.Items.FindByValue("0").Selected = true; } else { DropDownListReportsTo.Items.FindByValue(this.reportsToId.ToString()).Selected = true; //int reportsToId = EmployeeReportsTo.GetReportsToByEmployeeId(Convert.ToInt32(DropDownListEmployee.SelectedValue)).ReportsToId; //DropDownListReportsTo.Items.FindByValue(reportsToId.ToString()).Selected = true; } //int reportsToId = EmployeeReportsTo.GetReportsToByEmployeeId(Convert.ToInt32(DropDownListEmployee.SelectedValue)).ReportsToId; //DropDownListReportsTo.ClearSelection(); //if (reportsToId > 0 && this.add != "True") //{ // DropDownListReportsTo.Items.FindByValue(reportsToId.ToString()).Selected = true; // //LinkButtonByText.Visible = true; //} //else //{ // DropDownListReportsTo.Items.FindByValue("0").Selected = true; // //LinkButtonByText.Visible = false; //} }
private void BindReportsTo() { DropDownListReportsTo.DataSource = Employee.GetEmployeeListReportsTo(Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId); DropDownListReportsTo.DataTextField = "FormattedNameNumber"; DropDownListReportsTo.DataValueField = "EmployeeId"; DropDownListReportsTo.DataBind(); DropDownListReportsTo.Items.Insert(0, new ListItem("Please select", "0")); ListItem listItem = new ListItem(DropDownListReportsTo.Items.FindByValue(this.employeeId.ToString()).Text, this.employeeId.ToString()); DropDownListReportsTo.Items.Remove(listItem); }
protected void DropDownListEmployee_SelectedIndexChanged(object sender, EventArgs e) { int reportsToId = EmployeeReportsTo.GetReportsToByEmployeeId(Convert.ToInt32(DropDownListEmployee.SelectedValue)).ReportsToId; DropDownListReportsTo.ClearSelection(); if (reportsToId > 0) { DropDownListReportsTo.Items.FindByValue(reportsToId.ToString()).Selected = true; //LinkButtonByText.Visible = true; } else { DropDownListReportsTo.Items.FindByValue("0").Selected = true; //LinkButtonByText.Visible = false; } }