Asp.Net MVC The model item passed into the dictionary is of type Hatası
 

Asp.Net MVC de proje gelistirirken  "The model item passed into the dictionary is of type 'Alistesi.Controllers.BackofficeController', but this dictionary requires a model item of type 'Alistesi.Models.BackofficeModel'.", seklinde bir hata aliyorsaniz sebebini anlatacagim.

Ben bu hatayi Controller tarafinda ActionResult un dönüs degerini belirttigim yerde aldim. Söyle ki 

public ActionResult AddItemProcess()       
{           
   return View(
this);
}

Böyle bir ActionResut() yapmistim gördügünüz gibi dönüs tipine this demisim bundan dolayida yukarida hatayi almaya basladim. This denildiginde ActionResult' a verdigim ad ile ayni view' i mvc kendisi döndürecek diye düsünmüstüm ama mvc' de bu özellik henüz tanimli degil. Bende this' i kaldirarak
 

 public ActionResult AddItemProcess()       
{
           
   return View("AddItemProcess");

}

döndürecegi view sayfasini elle yazdim. Yani sizde buna benzer hata aliyorsaniz çalistirdiginiz ActionResult' in geriye ne döndürdügüne dikkat edin hata oradan kaynaklanabilmektedir.

 

Author: Engin ATALAY
Date: 17.05.2014 15:23:58
View Count: 8161
 
 

COMMENTS
 
Resim Yüklenemedi
Džerka
30 Ocak 2021 04:02
Its easy bro just remove some code and you got it
 
 
 
 
 
Resim Yüklenemedi
veli
27 Haziran 2014 18:17
hocam mvc dersleiniiz devamini bekliyoruz
 
 
 
 
 
 
 
 
 
 
 
 
WRITE COMMENT
 
 
Your Name :
 
 
 
E-mail :
 
 
 
Your Message :
 
 
 
 
 
 
 
This project : ASP.NET MVC , RAZOR, Entity Framework , CSS , HTML , JQUERY(2.0.2) , AJAX the C# side-tier architecture was developed with logic.
 
Yukarı Çık