一些关于Htmlhelper 和userhelper
Code
<%= Html.Encode(this.ViewData["Injection"]) %>
<hr />
<%= Html.ActionLink("Go back to Index", "Index") %><br />
<%= Html.ActionLink("Go back to Index with id = 1", "Index", new { id = 1 }) %><br />
<%= Html.ActionLink<HomeController>(c => c.Index(), "Go back to Index", new { style="color:red;" })%>
<hr />
<%= Html.Select("select_sample", new int[]{1, 2, 3, 4, 5}, 3) %>
<hr />
<% using (Html.Form<HomeController>(c => c.Index(), FormMethod.Post))
{ %>
<%= Html.SubmitButton() %>
<% } %>
<hr />
<a href="<%= Url.Action("Index") %>">Go back to Index</a><br />
<a href="Index?data=<%= Url.Encode("Hello&World") %>">Hello World</a>
<%= Html.RenderUserControl("~/Controls/PartialView.ascx") %>
重定向、Redirect
// Response.Redirect("/user/edit");
// return Redirect("/user/edit");
// return RedirectToAction("index", "home");
URL Routing
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults