【发布时间】:2014-01-04 20:47:18
【问题描述】:
我是 mvc 新手,我想知道如何将文本框文本分配给 mvc 中的另一个变量。
在 windows 中我们可以使用 textbox1.text = var body;
我怎样才能使用下面的代码来做类似的事情
我想在 textboxfor 中写入文本,以便调用 PAF 控制器索引操作的字符串邮政编码参数?
@Html.TextBoxFor(model => model.PostCode)
**Here we will get : postcode: ------------(Assume Postcode:52345)**
<input type="button" name="postcode" value="check your address" onclick="location.href='@Url.Action("Index", "PAF", new {Postcode = ...... )})'" />
**Here we will get : check your address button**
这是我的 PAF 控制器索引操作
public class PAFController : Controller
{
public ActionResult Index(string Postcode)
{
return View();
}
}
【问题讨论】:
-
为此,您需要一个 Ajax 调用。在这里查看我的答案stackoverflow.com/questions/20811513/…
标签: asp.net-mvc asp.net-mvc-4 razor html-helper html.textbox