ASP.Net MVC Error: Cannot implicitly convert type List<Category> to string

Last Reply 3 months ago By dharmendr

Posted 3 months ago


i have a view model and a partial view which i need to use again and again 

i want to pass conditional data to my partial view so one partial view can be used every where just pass conditional data but when i try to pass conditional data it gives error


Posted 3 months ago

As per your error you have declared productCategories as string and assigned Generic List to the properties.

var productCategories = "";

Change above line with the below.

var productCategories = new List<MVC_ViewModel.Models.Category>();