简体   繁体   English

我有一个 Aps 列表,我需要 select asp.net 和 c# 中该列表的一个或多个元素

[英]I have a a list of Aps and i need to select one or multiple elements of that list in asp.net with c#

I'm developing a school project with asp.net core mvc and i have a list of zones and i need to select from that list multiple elements, now i'm using a select like that我正在开发一个带有 asp.net 核心 mvc 的学校项目,我有一个区域列表,我需要从该列表中的多个元素中获取 select,现在我正在使用 select 这样的

<div  style="margin-bottom:2%;">
<p>Escolha os AP's que quer verificar</p>
<div style="margin-bottom:2%; width:70%; text-align:center; text-align-last:center ">
<select asp-for="ap" class="form-control">
  <option value="null"> Escolha um Ap ou todos</option>
  <option value="todos"> Todas as zonas </option>
    @foreach(var i in Model.Zones)
    {
         <option value=@i.zone_id> @i.zone_name </option>
    }
  </select>
 </div
</div> 

But when i use that i can´t select multiple options, soo exists any way to i can do that??但是当我使用它时,我不能 select 多个选项,所以我可以通过任何方式做到这一点? Even if i have to use something different.即使我必须使用不同的东西。

1个

Thats the zone Structure这就是区域结构

    public class L_Zone
    {
        public short zone_id { get; set; }
        public string? zone_name { get; set; }
        public decimal latitude { get; set; }
        public decimal longitude { get; set; }
        public DateTime? ts { get; set; }
        public bool Active { get; set; }
        public short geolocation_id { get; set; }

    }

Add the multiple boolean attribute to the select tag as follows:将多个 boolean 属性添加到 select 标签中,如下所示:

<select asp-for="ap" class="form-control" multiple>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM