Asp.net mvc 表单提交不提交部分视图

Asp.net mvc 表单提交不提交部分视图,asp.net-mvc,asp.net-mvc-2,Asp.net Mvc,Asp.net Mvc 2,我有一个主页,看起来像: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <% using (Html.BeginForm("Submit", "Customer", FormMethod.Get)) { %> <%Html.RenderPartia

我有一个主页,看起来像:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 
    <% 
     using (Html.BeginForm("Submit", "Customer", FormMethod.Get))
    { %>
     <%Html.RenderPartial("Attributes", "Shared");%> 
     <%=Html.TextBox("Name") %> 
     <%=Html.TextBox("Area") %>
     <%= Html.SubmitButton("Submit", "Click Submit")%>
<% } %>
public ActionResult Submit(FormCollection collection)
{

//Form collection is null. 

}
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<%@ Import Namespace="Cenovus.EquipList.Web" %>

<select id="Attribute1"><option value="-1"> Default</option>

</select>

<select id="Attribute2"><option value="-1"> Default</option>

</select>
Get请求URL不包含PartialView字段。但它包含主页字段。如何确保也提交部分视图

另外,为什么FormCollection为空

更新:

局部视图如下所示:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 
    <% 
     using (Html.BeginForm("Submit", "Customer", FormMethod.Get))
    { %>
     <%Html.RenderPartial("Attributes", "Shared");%> 
     <%=Html.TextBox("Name") %> 
     <%=Html.TextBox("Area") %>
     <%= Html.SubmitButton("Submit", "Click Submit")%>
<% } %>
public ActionResult Submit(FormCollection collection)
{

//Form collection is null. 

}
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<%@ Import Namespace="Cenovus.EquipList.Web" %>

<select id="Attribute1"><option value="-1"> Default</option>

</select>

<select id="Attribute2"><option value="-1"> Default</option>

</select>

违约
违约

您需要在表单元素上使用name属性,以使它们显示在表单值集合中。

能否提供部分视图的内容?FormCollection为null的原因是它是表单的集合,而不是表单元素。请参见在局部视图中将名称属性指定给select boxex,然后重试