SimplCommerce icon indicating copy to clipboard operation
SimplCommerce copied to clipboard

Language Switcher Tag helper

Open hishamco opened this issue 7 years ago • 3 comments

hishamco avatar Sep 11 '18 02:09 hishamco

What is the benefit of Tag helper over Partial view?

thiennn avatar Sep 11 '18 03:09 thiennn

Hope we will discuss this in details after finishing the localization stuff

hishamco avatar Sep 11 '18 03:09 hishamco

@thiennn I think using tag helpers over razor syntax make the code more readable. (its not about tag helpers vs partial views)

Consider the following code snippet for rendering partial views using tag helpers instead of razor syntax

<partial name="a" for="model"/>

###OVER

@Html.Partial()

Tag Helpers simplifies the code and makes it more readable while HtmlHelpers (Razor) makes it hard to read and maintain.

Look at the following page to render partial view using both HtmlHelpers nd tag helpers https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/partial-tag-helper?view=aspnetcore-3.1

More about Tag Helpers VS Razor Syntax here: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro?view=aspnetcore-3.1

rafsanulhasan avatar Mar 04 '20 16:03 rafsanulhasan