Include script once and only once in a custom Editor

前端 未结 3 1260

So I\'m trying to create a custom editor so that for a DataType of \"Duration\" a textbox appears with a masked format of HH:MM:SS.

I\'ve created a very

3条回答
  •  天涯浪人
    2020-12-18 01:19

    You can create singleton class with Dictionary property whic will store scripts from your custom helpers/templates. In your templates you can call method, that put script in singleton dictionary property with some string key. In that method you can prevent adding scripts with same keys.

    Finally you should to write a render action for rendering scripts from dictionary and call this action from your master layout.

    Here you can find solution similar to mine:

    Managing Scripts for Razor Partial Views and Templates in ASP.NET MVC

提交回复
热议问题