gpt4 book ai didi

c# - 如何将值从 View 传递到 Controller

转载 作者:行者123 更新时间:2023-11-30 13:13:39 27 4
gpt4 key购买 nike

我有一个问题。

我需要将 C# 和 MVC3 中的值传递给 Controller ​​,但我不知道如何传递。

我认为的代码是:

@html.textbox("Name"); 
<input value="Envoyer" type="submit">

请问如何将name 的值传到我的 Controller 中?

谢谢

最佳答案

还有另一种方式。

[HttpPost]
public ActionResult Index() {

string name = Request["name"];
}

关于c# - 如何将值从 View 传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5585081/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com