asp.net mvc - Rendering partial view with model and property set at instantiation -


par i'm trying call partial view, passing in new model, setting property value on instantiate.

the below code errors follows: 'cs1525: invalid expression term '{''

@html.partial("~/views/partials/_contactus.cshtml", new contactusmodel({thankyoupage = 555})) 

however if replace below, view renders without error:

@html.partial("~/views/partials/_contactus.cshtml", new contactusmodel()) 

can spot issue?

cheers

your syntax wrong if want set property during instantiate activity have way:

new contactusmodel() { thankyoupage = 555 } 

or

new contactusmodel { thankyoupage = 555 } 

Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World