避免在下拉菜单中重复输入 [英] avoid duplicate entry in dropdown
本文介绍了避免在下拉菜单中重复输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
我新加入为Asp.Net Developer.
我有一个问题.
我必须将数据库记录绑定到没有重复条目的DropDown
请帮助我.
Hi friends,
I newly joined as Asp.Net Developer.
I have one Question.
I have to bind Database Record to DropDown Without Duplicate Entries
Please Help Me.
public void BindPrjNmToDrpDwn()
{
int EmplId = Convert.ToInt32(Session["UserID"]);
var PrjNm = (from table2 in objPms.PM_TaskDetails
join tabPrj in objPms.PM_ProjectDetails on table2.Proj_Id equals tabPrj.Project_ID
where table2.AssignedBy == Convert.ToString(EmplId)
select tabPrj.Proj_Title);
ddlAllProject.DataSource = PrjNm;
ddlAllProject.DataBind();
推荐答案
最后添加唯一性,
var PrjNm = (from table2 in objPms.PM_TaskDetails
join tabPrj in objPms.PM_ProjectDetails on table2.Proj_Id equals tabPrj.Project_ID
where table2.AssignedBy == Convert.ToString(EmplId)
select tabPrj.Proj_Title distinct);
这篇关于避免在下拉菜单中重复输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文