views:

133

answers:

2
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

What gives? The semicolon on line 58 IS THERE..

+7  A: 

You are using the as keyword to cast to a method call.

ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel();

Are you sure this is a method, and not a type? Have you tried removing the parens?

ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel;
Kyle Trauberman
ah, you know I had a feeling it was something like that when I was driving back from lunch, I just modded the code from a ... new ...ViewModel(); and forgot to remove the (), THANKS!
shogun
+2  A: 
<% KODmvc.Models.AssetRatingViewModel ratingModel = ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel(); %>

should be

<% KODmvc.Models.AssetRatingViewModel ratingModel = ViewData["RatingViewModel"] as KODmvc.Models.AssetRatingViewModel; %>
mbarnett