I Have a "For Loop" In ASP.NET Core Like This :
<button type="submit" Form="FormActive" name="id" value="@item.I"></button>
<!--It Will Create SomeThing Like This:-->
<button type="submit" Form="FormActive" name="id" value="1"></button>
<button type="submit" Form="FormActive" name="id" value="2"></button>
<button type="submit" Form="FormActive" name="id" value="3"></button>
... ... ... ... 4
... ... ... ... 99
<!--And This Is My Single Form : -->
<form id="FormActive" action="/action_page">
</form>
Whats The Problem?
why This Form Just Send A httpRequest POST Without"ID" And Value?(infact It Will Send A Post Request With Empty Body)
What I Should To do for send ID
Edit: I cant Remove Form – And I Cant Use +99 Form too
maybe i need jquery … or something?
2
Answers
You have to use input tag with type="submit" name="id" value="1"
Buttons does not have name and value attributes.
How about try
asp-action
, likeThen in controller:
result:
Update:
Try to use
<a>
tag without With Tag FormThen in controller;
result: