【发布时间】:2021-04-23 15:39:41
【问题描述】:
我只想选中选中的复选框。我试过了。
<input class="form-check-input" type="checkbox" name="Box" value="LDL" />
<label for="Box">LDL</label><br>
<input class="form-check-input" type="checkbox" name="Box" value="LDL" />
<label for="Box">LDL</label><br>`enter code here`
<input class="form-check-input" type="checkbox" name="Box" value="HDL" />
<label for="Box">HDL</label><br>
<div class="button-holder d-flex justify-content-center">
<button type="submit" class="btn btn-success">Send</button>
</div>
这就是行动
[HttpPost]
public IActionResult SendTest(ListParams listParams)
{
}
这是 DTO
公共类 CheckboxParams { 公共字符串框 { 获取;放; }
public bool IsChecked { get; set; }
}
public class ListParams
{
public ListParams()
{
this.AllCheckedParams = new List<CheckboxParams>();
}
public List<CheckboxParams> AllCheckedParams { get; set; }
}
【问题讨论】:
-
嗨@DimitarKazakov,欢迎来到StackOverflow。请进一步详细说明您在问题中遇到的问题。您可以阅读How to create a Minimal, Reproducible Example 来更新您的问题。谢谢。
-
你应该用
asp.net-core而不是asp.net来标记你的问题。
标签: c# asp.net-core