2016-09-22 49 views
0

我有一個錯誤:參數字典包含參數「電話」無效項

"The parameters dictionary contains a null entry for parameter 'Phone' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Order(Int32[], Int32[], System.String, Int32, System.String, Int32, System.String, System.String, System.String, System.String)' in 'Shop.Controllers.HomeController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."

這是我的控制器

public ActionResult Order(int[] OrderProductCount, int[] OrderProductID, string AllName, int Phone, string Region, int MailIndex, string Email, string City, string MailType, string Additional=null) 
    { 
     return View("Order"); 
    } 

我能不明白的地方是錯誤的,因爲當我設置表單方法屬性獲得,它有電話號碼:

http://localhost:2420/Order?AllName=asdasd&Email=asdsaasd%40asd&City=sdafsdaf&Region=dsfasda&Phone=380983050430&MailIndex=100005&Additional=&MailType=%D0%98%D0%BD%D0%A2%D0%B0%D0%B9%D0%BC&OrderProductID=53&OrderProductCount=32&OrderProductID=52&OrderProductCount=12 
+0

你可以顯示在你的控制器中調用'Order'動作的代碼嗎? – Supersnake

+0

你有沒有嘗試在手柄串控制器? –

回答

0

電話號碼(380xxxxxxxxx)是整數範圍(-2, 147,483,648至2,147,483,647)。

+0

因此,如果你使該參數爲一個字符串,它應該工作 –

相關問題