I have made a Asp.net core view and getting data from database is working, but I want to add adding comments option. Comments send almost properly, but while sending a comment I need to pass "samochodId" from my asp.net core model which was passed first.
<div class="form-group">
<label asp-for="Komentarz.Wiadomosc" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Komentarz.Wiadomosc" class="form-control" />
<span asp-validation-for="Komentarz.Wiadomosc" class="text-danger"></span>
<input asp-for="Komentarz.samochodId" class="form-control" />
</div>
</div>
This works, but I need to remove this line: <input asp-for="Komentarz.samochodId" class="form-control" />
and do the pass automaticly by getting this Id from My model (Model.Samochod.Id) or maybe from the route?. How Can I do this?
使用隐藏字段<input type="hidden" asp-for="Komentarz.samochodId" />
并确保它在表单<form></form>
元素的打开和关闭内
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.