Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put my custom Html Helpers?

Where to put the helper class in the project folder hierarchy ?

like image 915
user137348 Avatar asked Dec 31 '09 13:12

user137348


People also ask

Where do we use HTML helpers?

An HTML Helper is just a method that returns a HTML string. The string can represent any type of content that you want. For example, you can use HTML Helpers to render standard HTML tags like HTML <input>, <button> and <img> tags etc.

How do you create an HTML helper?

The easiest way to create a new HTML Helper is to create a static method that returns a string. Imagine, for example, that you decide to create a new HTML Helper that renders an HTML <label> tag. You can use the class in Listing 2 to render a <label> .

Should I use tag helpers or HTML helpers?

Tag Helpers are attached to HTML elements inside your Razor views and can help you write markup that is both cleaner and easier to read than the traditional HTML Helpers. HTML Helpers, on the other hand, are invoked as methods that are mixed with HTML inside your Razor views.

How can create HTML helper in core in asp net?

To create a custom HTML helper you have create a static class and static method. below example is for a custom HTML helper for submit button. Make sure you add below using statements.


1 Answers

I would suggest creating a seperate class library so that you can reuse your helpers in other projects as well.

like image 91
Sayed Ibrahim Hashimi Avatar answered Sep 19 '22 00:09

Sayed Ibrahim Hashimi