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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -