我有以下控制器
GET
[HttpGet]
public ActionResult Product_Search([Bind(Prefix = "Form_ProductCollection")]ProductCollection _Productcollection)
{
POST
[HttpPost]
public ActionResult Product_Search([Bind(Prefix = "Form_ProductCollection")]ProductCollection _Productcollection, string Product_TypeID, string Product_CategoryID, string CountryID, string SubsidaryID, DateTime? CreateDate)
{
我有以下表格
@using (Html.BeginForm("Product_Search", "Home", FormMethod.Post , new { Product_TypeID = Model.Form_ProductCollection.ProductType_ID, Product_CategoryID = Model.Form_ProductCollection.ProductCategory_ID, CountryID = Model.Form_ProductCollection.Country_ID, SubsidaryID = Model.Form_ProductCollection.Susidary_ID, CreateDate = Model.Form_ProductCollection.CreatedDate}) )
{
初始加载我想绑定空值,然后当我单击提交按钮时将参数传递给POST方法
但是,一旦我这样做了以下错误
System.NullReferenceException:未将对象引用设置为对象的实例。