删除下拉列表值
我在 MVC2 中工作。这里我有员工屏幕。我本身就有一个下拉列表。所有员工姓名都将加载。我正在查看的员工个人资料不应加载到下拉列表中。我应该从下拉列表中删除特定的员工。这是我加载下拉列表的代码...如何做到这一点...
Dictionary<string, Employee> Employee1 = new Dictionary<string, EmployeeDetails>();
Employee1 = EmployeeProxy.GetPrimaryEmployeeList(UserIdentity.TenantID);
List<EmployeeDetails> managerDetailsList = Employee1.Values.ToList();
if (managerDetailsList != null && managerDetailsList.Count > 0)
{
managerDetailsList.Sort(delegate(EmployeeDetails p1, EmployeeDetails p2) { return p1.FirstName.CompareTo(p2.FirstName); });
}
foreach (EmployeeDetails employeedetails in managerDetailsList)
{
employeedetails.FirstName = employeedetails.FirstName + " " + employeedetails.LastName;
}
I am working in MVC2. Here i had Employee Screen. There itself i am having a dropdown list. In that all the Employee Names will loaded. The Employee profile which i am viewing should not be loaded in the dropdown list. I should remove the particular Employee from the dropdown list. Here is my code for loading dropdown...How to do this...
Dictionary<string, Employee> Employee1 = new Dictionary<string, EmployeeDetails>();
Employee1 = EmployeeProxy.GetPrimaryEmployeeList(UserIdentity.TenantID);
List<EmployeeDetails> managerDetailsList = Employee1.Values.ToList();
if (managerDetailsList != null && managerDetailsList.Count > 0)
{
managerDetailsList.Sort(delegate(EmployeeDetails p1, EmployeeDetails p2) { return p1.FirstName.CompareTo(p2.FirstName); });
}
foreach (EmployeeDetails employeedetails in managerDetailsList)
{
employeedetails.FirstName = employeedetails.FirstName + " " + employeedetails.LastName;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RobinHood,
只需将此行:更改
为:
假设存在这样的属性(ID)。基本上,我所说的是从 managerDetailsList 中排除 Employee1 成员(基于 Employee1.Values 是 IQueryable 的假设)。
RobinHood,
Simply change this line:
to:
assuming that such an attribute (ID) exists. Basically, what i'm saying is that from the managerDetailsList, exclude the Employee1 member (based on the assumption that Employee1.Values is IQueryable).