Link to home
Start Free TrialLog in
Avatar of gökmen anıl yılmaz
gökmen anıl yılmaz

asked on

how can i four dropdownlist search for mvc.net

hi;

I want to search in four other dropdown lists and list it in another place. Mvc.Net
Avatar of J0rtIT
J0rtIT
Flag of Venezuela, Bolivarian Republic of image

Maybe if you post some code or sample code we can manage to answer this, my friend.
Avatar of gökmen anıl yılmaz
gökmen anıl yılmaz

ASKER

the codes I use to fill the dropdownlist

controller

  var illerList = _db.iller.ToList();

            List<SelectListItem> item8 = new List<SelectListItem>();
            foreach (var c in illerList)
            {
                item8.Add(new SelectListItem
                {
                    Text = c.ilAdi,
                    Value = c.il_Id.ToString()
                });
            }
            ViewBag.illerList = item8;


            var Derskategorileri = _db.DersKategorileri.ToList();

            List<SelectListItem> item9 = new List<SelectListItem>();
            foreach (var d in Derskategorileri)
            {
                item9.Add(new SelectListItem
                {
                    Text = d.Kategori,
                    Value = d.Id.ToString()
                });
            }
            ViewBag.Derskategorileri = item9;

Open in new window



html
   @if (ViewBag.illerList != null)
                                        {

                                            @Html.DropDownList("IlId", (IEnumerable<SelectListItem>)ViewBag.illerList, "Şehir Seçiniz", new { @class = "chosen-select" })
                                        }

                                    </div>
                                    <div class="main-search-input-item">

                                    
                                        @Html.DropDownList("IlceId", (IEnumerable<SelectListItem>)ViewBag.illerList, "İlçe Seçiniz")
                                      
                                    </div>
                                    <div class="main-search-input-item location">


                                        @if (ViewBag.Derskategorileri != null)
                                        {

                                            @Html.DropDownList("DkId", (IEnumerable<SelectListItem>)ViewBag.Derskategorileri, "Ders Kategorileri", new { @class = "chosen-select" })

                                            @*@Html.DropDownListFor(model => model.Item2.il_Id, ViewBag.illerList as SelectList, "---İl Seçiniz---", new { @class = "form-control", Id = "il_Id" })*@
                                        }

                                    </div>
                                    <div class="main-search-input-item">

                                        @Html.DropDownList("BdId", (IEnumerable<SelectListItem>)ViewBag.Derskategorileri, "Ders Seçiniz", new { @class = "form-control" })
                                    
                                    </div>

Open in new window


this code

according to these codes, I have four dropdown lists and I want to search and list them in another page
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.