現在我正在使用搜索功能。我有一個文本框和一個按鈕,並在充滿員工的數據庫中搜索。在另一個Web部分,員工可以將他們的技術技能保存在數據庫中,也可以在他們所處的級別(初級,中級,高級或專家級)中進行。 當我作爲管理員想要查找知道例如C#的員工時,我只需要搜索它,並且所有具有該技能的員工都會在gridview中查找。從數據庫中篩選搜索結果
但在這裏我的問題是:
是否有可能來過濾這些結果?例如,如果我在搜索後添加了checkboxlist,並且想要篩選C#上「專家」的員工,是否可以僅顯示它們? 對不起,我盡力而爲。希望我能得到答案。
這裏是我如何尋找一個代碼示例:
private void SearchEmployeeSkillEng()
{
using (var db = new KnowItCvdbEntities())
{
var searchTechSkill = (from p in db.EMPLOYEES
join ets in db.EMPLOYEES_TECHNICAL_SKILLS on p.employee_id equals
ets.employee_id
join ts in db.TECHNICAL_SKILLS_VALUES on ets.technical_skill_value_id
equals
ts.technical_skill_value_id
join tsl in db.TECHNICAL_SKILL_LEVEL on ets.technical_skill_level_id
equals
tsl.technical_skill_level_id
where
ts.skill_name.Contains(TextBoxSearchCvEng.Text) ||
ets.skill_name_other.Contains(TextBoxSearchCvEng.Text)
select new TechnicalSkillsSearch()
{
EmployeeId = p.employee_id,
FirstName = p.firstname,
LastName = p.lastname,
TechnicalSkillValueId = ts.technical_skill_value_id,
SkillName = ts.skill_name,
SkillNameOther = ets.skill_name_other,
SkillType = ts.skill_type,
TechnicalSkillLevelId = tsl.technical_skill_level_id,
SkillLevel = tsl.skill_level
}).ToList();
if(searchTechSkill.Count > 0)
{
LabelException.Visible = false;
foreach (var vTechSkill in searchTechSkill)
{
if (vTechSkill != null)
{
if (vTechSkill.SkillNameOther != null)
{
if (!_searchEmpListEng.Contains(vTechSkill.FirstName + " " + vTechSkill.LastName + "," +
vTechSkill.EmployeeId))
{
_searchEmpListEng.Add(vTechSkill.FirstName + " " + vTechSkill.LastName + "," +
vTechSkill.EmployeeId.ToString());
}
}
else
{
if (!_searchEmpListEng.Contains(vTechSkill.FirstName + " " + vTechSkill.LastName + "," +
vTechSkill.EmployeeId))
{
_searchEmpListEng.Add(vTechSkill.FirstName + " " + vTechSkill.LastName + "," +
vTechSkill.EmployeeId.ToString());
}
}
}
}
}
else
{
LabelException.Visible = true;
LabelException.Text = "Nothing found";
}
_dtEng.Clear();
}
}
TECHNICAL_SKILLS_VALUES是例如C#,MS ACCESS等,並TECHNICAL_SKILL_LEVEL是例如專家,初學者等
你的克里斯蒂安
是的,這是可能的。您修改查詢以包含新過濾器或者過濾GridView客戶端。發佈一些代碼。哦,對不起,不知道SharePoint。 –
@SamLeach,只需提供圖片和代碼示例。 – Kriistiian