LazZiya TagHelpers

Collection of useful tag helpers for .NetCore web applications.

Collection of helpful TagHelpers for any ASP.NET Core project.

Latest release

20 June 2019

Contents

Installation:

Install via nuget :

Install-Package LazZiya.TagHelpers -Version 2.2.1

add tag helper to _ViewImports.cshtml:

@addTagHelper *, LazZiya.TagHelpers

Code Samples

Localize TagHelper

Use simple html tag to localize text/html in razor views

<localize>Hellow world!</localize>

Requires LazZiya.TagHelpers.Localization and LazZiya.ExpressLocalization nuget packages.

Read more:

Alert TagHelper

Easily create bootstrap 4.x alerts from c# backend or razor pages using html codes.
All bootstrap alerts can be created from both ends (Primary, Secondary, Success, Info, Warning, Danger, Light, Dark).

Create alert from razor page using HTML

<alert-success>Congratulations! you have done the job!</alert-success>

Create alert from c# backend

Alert are TempData items, so they will be disposed once they are fetched.
You can create alerts from the c# backend by the provided extension methods for TempData as below:

using LazZiya.TagHelpers.Alerts

TempData.Danger("Ooopps! something went wrong with the code, please contact support.");

Then use alert tag helepr on razor side to render the alerts:

<alert view-context="ViewContext"></alert>

Read more :

LocalizationValidationScripts TagHelper

will add all required js files and code to validate localized input fields like numbers, date and currency. These scripts will help to validate localized decimal numbers with comma or dot format (e.g. EN culture: 1.2 - TR culture: 1,2).

1- Register tag helper component in startup. Don’t apply this step if you are using ExpressLocalization it will be done automatically

services.AddTransient<ITagHelperComponent, LocalizationValidationScriptsTagHelperComponent>()

2- Add this code to the scripts section in the page:

<localization-validation-scripts></localization-validation-scripts>

For more details :

LangaugeNav TagHelper

<language-nav view-context="ViewContext"></language-nav>

For more details :

SelectEnum TagHelper

Sample enum :

public enum WeekDays { MON, TUE, WED, THU, FRI, SAT, SUN }

create the related select list dropdown in razor page :

<select-enum 
        enum-type="typeof(WeekDays)" 
        name="weekDay">
</select-enum>

For more details :

Paging TagHelper

Only few parameters are required to fireup the agination control

<paging total-records="Model.TotalRecords"
        page-no="Model.PageNo"
        query-string-value="@(Request.QueryString.Value)"
        show-prev-next="true">
</paging>

it is important to add query-string-value if there is multiple filtering parameters in the url.

For more details :

Live Demos :

http://demo.ziyad.info/en/

License

https://github.com/LazZiya/TagHelpers/blob/master/LICENSE