public ActionResult Index(string searchstring, string search,string dept)
{
var DesigList = new List();
var desigQuery = from d in db.students
orderby d.dept
select d.dept;
DesigList.AddRange(desigQuery.Distinct());
ViewBag.Desig = new SelectList(DesigList);
if (!String.IsNullOrEmpty(dept))
{
contact = contact.Where(x => x.dept == dept);
}
return View(contact);
}
and this is Index.view
@using (Html.BeginForm())
{
<p>
FirstName: @Html.TextBox("searchstring") Lastname: @Html.TextBox("search") DEPT: @Html.DropDownList("dept","All")
<input type="submit" value="Search" />
</p>
}
i am using mvc4 and their is problem in dropdown list can you check please
1315
08-Aug-2016
Updated on 08-Aug-2016
Can you answer this question?
Answer
0 Answers