これは私のアクションビューです:
public ActionResult promo()
{
var model = (from p in entity.promotion
where p.vehicule.Idag == User.Identity.Name
select p).ToList();
return View(model);
}
これは私の HttpPost アクションです:
[HttpPost]
public ActionResult promo(string idv, string dd, string df, string remise)
{
try
{
//some code
ViewData["Resultat"] = "L'ajout de promotion à reussi";
return View();
}
else
{
ViewData["Resultat"] = "Une promotion existe deja dans cette periode";
return View();
}
}
catch (Exception)
{
ViewData["Resultat"] = "L'ajout de promotion à echoué Veillez verifiez le Matricule de véhicule ou ressayer plus tard ";
return View();
}
}
アクションを呼び出すと、次のエラーが発生します。
La référence d'objet n'est pas définie à une instance d'un object.
この行で:
<% foreach (var item in Model) { %>
URLに移動してgoキーをクリックするとこのエラーが発生した後でも、ページ間を移動するとページが正常に機能します。ここに何か単純なものが欠けていると思いますか?