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

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

Why does PHP consider 0 to be equal to a string? -

formula - R: how to pass in a reference to the variable in glm or lm? -