Friday, October 10, 2014

Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions


@Html.DisplayFor(modelItem =>  item.CategoryType == "1" ? "Photo Category" : "Video Category");

instead of above, we can write code like below :

 @{
         string CategoryType = item.CategoryType == "1" ? "Photo              Category" : "Video Category";
  }
   
 @Html.DisplayFor(modelItem => CategoryType)
Protected by Copyscape Plagiarism Software