Hello,
I want to search with dropdownlist in asp.net mvc, but I cannot do it, how can I do it?
@Html.DropDownList("GRUP", (List<SelectListItem>)ViewBag.grup, "", new { })
<button class="btn btn-secondary">Ara</button>
public ActionResult Urunler(int? id, int? kimlik)
{
var ad = (string)Session["FIRMAKODU"];
ViewBag.firma = ad;
var plasiyerid = (string)Session["PLASIYERID"];
ViewBag.plasiyer = plasiyerid;
ViewBag.cariid = id;
ViewBag.fisid = kimlik;
List<SelectListItem> grup = (from x in db.WEBSTOK
group x by x.GRUP into g
select new SelectListItem
{
Text = g.Key,
Value = g.Key.ToString()
}).ToList();
ViewBag.grup = grup;
var stok = db.WEBSTOK.Where(x => x.FIRMA == ad & x.PLASIYER == plasiyerid).ToList();
return View(stok);
}