控制不传递给mvc4中的操作-斐波那契级数
本文关键字:操作 mvc4 控制 | 更新日期: 2023-09-27 18:25:32
提交表单时,控件不会传递给操作。我在操作中有一个断点,但控制不在那里。谢谢控制未传递到操作-mvc4 中的fibonacci
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
return View();
}
[HttpPost]
public ActionResult finonacci()
{
return View();
}
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("finonacci","Home",FormMethod.Post))
{
<p>Enter a number</p> @Html.TextBox("Input")
<br />
<input type="button" id="btnsubmit" value="Check" />
}
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("fibonacci", "Home", FormMethod.Post))
{
<p>Enter a number</p> @Html.TextBox("Input")
<br />
<input type="Submit" id="btnsubmit" value="Check" />
}
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult fibonacci(int Input)
{
if (Input > 1)
{
int a = 0;
int b = 1;
// In N steps compute Fibonacci sequence iteratively.
for (int i = 0; i < Input; i++)
{
int temp = a;
a = b;
b = temp + b;
Response.Write("<p>fibonacci series " + b.ToString() + "</p>");
}
return View("Index");
}
return View("Index");
}
}