1
我做的這個小教程到控制器:http://www.asp.net/mvc/videos/mvc-2/how-do-i/creating-a-tasklist-application-with-aspnet-mvc傳遞一個字符串中使用ASP MVC
但不知何故,他路過一個字符串返回到控制器。但我無法讓我的弦回來。我錯過了什麼?
Create.aspx
<form method="post" action="/Home/CreateNew">
<label for="task">Task:</label>
<input type="text" name="task" />
<input type="submit" value="Add Task" />
</form>
HomeController.cs
public ActionResult CreateNew(object obj) // <-- expecting a string but getting an object.
{
string whattype = obj.GetType().ToString(); //just an obj, expecting a string
//add to DB next
}