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)

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software