Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Html Helper Not Working #10377

Closed
akash3456 opened this issue May 19, 2019 · 1 comment
Closed

Static Html Helper Not Working #10377

akash3456 opened this issue May 19, 2019 · 1 comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question

Comments

@akash3456
Copy link

Hi,
Can someone please tell me how the HtmlHelper class in Net Core MVC can be extended?
What I have tried is the following :-
Create HtmlHelper Static Class.
method :- public static string CreateDate(this HtmlHelper,String Message){}

method is not accessible from within the Razor view when i do:

Html.

the ViewImports does have the helper namespace in as well.

Kind Regards

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 20, 2019
@pranavkm
Copy link
Contributor

The injected HtmlHelper is an IHtmlHelper<T> instance. You should update the extension method to target this type: public static string CreateDate<TValue>(this IHtmlHelper<TValue,String Message){}

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Projects
None yet
Development

No branches or pull requests

3 participants