Compiler Error Message: CS1002: ; expected
Source Error:
Line 56: </div><!--end #Asset-->
Line 57:
Line 58: <% KODmvc.Models.AssetRatingViewModel ratingModel = ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel(); %>
Line 59: <% Html.RenderPartial("RatingView", ratingModel); %>
Line 60:
Source File: c:\RatingSystem\Views\Asset\ArticleView.aspx Line: 58
是什么给出的?第58行的分号是那里..
答案 0 :(得分:7)
您正在使用as
关键字转换为方法调用。
ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel();
你确定这是一种方法,而不是一种类型吗?你试过去除parens吗?
ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel;
答案 1 :(得分:2)
<% KODmvc.Models.AssetRatingViewModel ratingModel = ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel(); %>
应该是
<% KODmvc.Models.AssetRatingViewModel ratingModel = ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel; %>