【发布时间】:2021-07-08 20:49:36
【问题描述】:
这类似于使用 asp.net 核心的“添加到购物车”功能。因此,例如,如果有人单击汉堡图像旁边的按钮,则应将其重定向到 Order 创建页面,并在 ProductName 字段中填充文本“Burger”。
我尝试过使用@Html.ActionLink,但这只会将您引导至新页面并且不会填充该字段。按下按钮时填充字段的替代方法有哪些。
This is the button that needs to populate the ProductName field
This is what the end result should be
任何提示或建议将不胜感激
【问题讨论】:
-
欢迎来到 Stack Overflow。请通过tour 了解 Stack Overflow 的工作原理,并阅读How to Ask 了解如何提高问题的质量。然后查看help center,看看你可以问什么问题。请显示您尝试过的尝试以及您从尝试中得到的问题/错误消息。
-
可以使用
asp-route-param="@Model.Name",然后在后台在你的create方法中使用参数·string param接受,最后传递给视图。
标签: asp.net-core model-view-controller asp.net-core-mvc