asp.net mvc - Display a checkbox using Razor -


i have declared bool property so;

public bool applyingmyself { get; set; } 

i have following mark-up checkbox

@html.label("i young person applying myself") @html.checkboxfor(m => m.applyingmyself) 

but receiving error

model' not contain definition 'applyingmyself' , no extension method 'applyingmyself' accepting first argument of type 'model' found (are missing using directive or assembly reference?)

any appreciated...

some additional context may required answer question following may address issue.

ensure you've declared model you're implementing in view:

//at top of view: @model modelname   // code checkbox in view @html.label("i young person applying myself") @html.checkboxfor(m => m.applyingmyself) 

if case , have model declared in view, possible you've updated model applyingmyself property , visual studio "unaware" of change.

  1. try rebuilding project (in vs 2017 can select build -> rebuild). clear projects binaries , rebuild them scratch.
  2. try restarting visual studio.

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -