我有一个如下所示的文本框
@using (Html.BeginForm("checkUserType", "Place", new {type = }))
{
<div id="login">
<div class="userNameLabel">UserName</div>
<div class="userNameField"><input type="text" id="txtUserName"/><span><input type="button" value="ok" id="ok" /></span></div>
</div>
}
我想将文本框值传递给我的控制器。为此,我使用了以下代码,但它不起作用...请帮助...
动作方法
[HttpPost]
public ActionResult checkUserType(string type)
{
var elements = from element in db.USERS
where element.UserType == type
select element;
if (elements == null)
{
return RedirectToAction("Index");
}
else
{
return RedirectToAction("Place/Index");
}
}