c# - Razor declarative helper passing model as parameter -


how can pass model custom html helper parameter?

currently have following file

@helper labelfor(string label, string hint) {     <label for="@label">@label</label>     <span class="mif-info"           data-role="hint"           data-hint-background="bg-blue"           data-hint-color="fg-white"           data-hint-mode="1"           data-hint-position="top"           data-hint="@hint"></span> } 

which called with

@myhelpers.labelfor(html.displaynamefor(model => model.title).tostring(), "description") 

how can simplify

@myhelpers.labelfor(model => model.title, "description") 

i guess, can achieve same using mvc displaytemplates. did try path?


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -