后台传递对象:
public ActionResult Edit(int id)
{
Category c = service.GetCategory(id);
return View("EditCategory",c);
}
页面获取对象
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BookShopMVC.Models.Category>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div style="padding: 20px;">
<% Html.BeginForm("EditCategory", "Category", "Category");%>
目录名:<%= Html.TextBox("CategoryName", Model.CategoryName, new { style = "border:1px solid #6CABE7; width:400px; height:20px; " })%><input
type="submit" value="提交" />
<input type="hidden" name="CategoryId" id="CategoryId" value="<%=Model.CategoryId %>" />
<% Html.EndForm(); %>
</div>
</asp:Content>