I have a gridview in my form,in which there is dropdownlist that is fill up using following codeHide Copy Code
DropDownList ddlEmployee = (DropDownList)row.FindControl("ddlEmp");
DropDownList ddlEmployee2 = (DropDownList)row.FindControl("ddlEmp2");
var Emplist1 = _service.GetAllSectorEmployee();
ddlEmployee.Bind(Emplist1, "EmployeeIdName", "Employee_Id");
ddlEmployee2.Bind(Emplist1, "EmployeeIdName", "Employee_Id");
i have a requirement that when ever employee is selected ,then it will remove from list,i have done it using following code,Hide Copy Code
var removelist = _service.GetAllSectorEmployee().Where(x => x.Employee_Id == Emp2).FirstOrDefault();
_service.DeleteSectorEmployee(removelist);
problem is that when employee is removed ,dropdownlist will be updated and also remove that employee.how can i do it? i try following code but fruitlessHide Copy Code
DropDownList ddlEmployee = (DropDownList)row.FindControl("ddlEmp");
DropDownList ddlEmployee2 = (DropDownList)row.FindControl("ddlEmp2");
var Emplist1 = _service.GetAllSectorEmployee();
ddlEmployee.Bind(Emplist1, "EmployeeIdName", "Employee_Id");
ddlEmployee2.Bind(Emplist1, "EmployeeIdName", "Employee_Id");