79440144

Date: 2025-02-14 17:38:11
Score: 0.5
Natty:
Report link

I just came across this as I was having a similar issue.

the only problem is that I have to call this in a view with @model in order for it to work, otherwise attributes will always be empty

The simple answer is that you can't because without the @model directive defining the type, the view assumes that the model is dynamic and so the HtmlHelper parameter of the extension method will actually be IHtmlHelper<dynamic>. That is my understanding.

If you have since found an way round this, please let me know.

Reasons:
  • RegEx Blacklisted phrase (2.5): please let me know
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @model
  • High reputation (-2):
Posted by: Digbyswift