【发布时间】:2021-04-14 12:10:35
【问题描述】:
我有以下代码在单选按钮中显示IList<string> 数组。我怎样才能通过前一个月/秒?
在我看来,我有以下代码,目前我只显示选定的单选按钮值
foreach (var record in Model.Months.Select(x=>$"{x.Substring(4,2)}/{x.Substring(0,4)}").OrderByDescending(x=>x))
{
<div class="radio col-12">
<div class="row">
<div class="col-5" style="">
@Html.RadioButton("MonthsAvailable", record, true, new { id = record, @class = "m-r" })<label>@record</label>
</div>
</div>
</div>
}
我的模型如下所示
public class MonthsAvailable
{
public List<string> Months{ get; set; }
}
我的行动收到
public async Task<IActionResult> MonthsAvailable(List<string> monthsAvailable)
{
...
}
我的单选按钮如下所示
When I select 062020 pass only 062020 to the controller,
When I select 072020 pass 062020 and 072020,
when I select 082020 pass 062020, 072020 and 082020
when I select 092020 pass 062020, 072020, 082020 and 092020 and etc
【问题讨论】:
标签: javascript c# jquery asp.net-mvc razor-pages