Reputation: 1
This is a syntax question that I can't figure out because I am new to MVC and the razor view engine. I've wrote a directive in a view with a master layout. The directive is @model Demo.ViewModels.Shared.Grid and asp.net is expecting a ";" somewhere. Consequently, I getting an invalid expression and the view isn't call my class properly. What am I doing wrong?
Upvotes: 0
Views: 1171
Reputation: 4373
I would also like to point out that in VB the directive is @ModelType
vs the directive in C# of @model
Upvotes: 0
Reputation: 150303
You didn't share much information about your problem, however your question can still be answered.
Many times, new MVC users write @{ }
instead of @()
. The @{}
is a code block, so each line of code within the block must end with a semicolon ;
, like regular C# code. Whereas @()
renders to the response the result of the code, and doesn't require anything contained in it to end with a semicolon ;
.
Upvotes: 2