Note that there are some explanatory texts on larger screens.

plurals
  1. POlist depends on the change in the index of dropdownlist in mvc
    primarykey
    data
    text
    <p>I have two things in my view 'ListUrl.cshtml' a dropdown list filled with the names of URLs. a list where I 'URLs' as the first column capitals.</p> <p>What I want is that when I select an item from the dropdown list, the list is automatically adjusted according to the selection. when I select a URL then I only see that url in the list.</p> <p>In Model:</p> <pre><code>public class UrlItem { public int Id { get; set; } public string urlll { get; set; } public int toontijd { get; set; } public int positie { get; set; } } </code></pre> <p>In HomeController:</p> <pre><code>public ViewResult ListUrl() { var ws = new Service1(); localhost.Service1 s1 = new Service1(); localhost.UrlInfo[] ui = s1.GetOrders(); Models.ListUrl.UrlList = new List&lt;OrderItem&gt;(); for (int i = 0; i &lt; ui.Length; i++) { var OrderItem = new OrderItem(); OrderItem.Id = Convert.ToInt32(ui[i].Id); OrderItem.urlll = ui[i].url; OrderItem.toontijd = ui[i].ToonTijd; OrderItem.positie = Convert.ToInt32(ui[i].positie); Models.ListUrl.UrlList.Add(OrderItem); } //return result; var urlname = from url in s1.GetUrlInfo() select url ; ViewData["url"] = new SelectList(urlname, "Id", "url"); return View(); } </code></pre> <p>And in the View:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;th&gt; @Html.DropDownList("url", (SelectList)ViewData["url"], "---All") &lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th&gt; Url &lt;/th&gt; &lt;th&gt; ... &lt;/th&gt; &lt;th&gt; &lt;/th&gt; &lt;th&gt; ... &lt;/th&gt; &lt;/tr&gt; @foreach (var item in ListUrl.UrlList) { &lt;tr&gt; &lt;td&gt; @item.urlll.ToString() &lt;/td&gt; &lt;td&gt; @item.toontijd.ToString() &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; @item.positie.ToString() &lt;/td&gt; &lt;/tr&gt; } </code></pre> <p></p> <p>I hope someone can help this mvc beginner :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload