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
Post a Comment